From 157d639afce8cea89f03701d6badf4a9e0854772 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 19 Dec 2014 10:38:32 -0800 Subject: [PATCH] Update rust and all deps --- .travis.install.deps.sh | 2 +- Cargo.lock | 69 +++++++----- Cargo.toml | 6 +- src/bin/cargo.rs | 64 ++++++------ src/cargo/core/package_id.rs | 8 +- src/cargo/core/registry.rs | 2 +- src/cargo/core/resolver/encode.rs | 10 +- src/cargo/core/source.rs | 19 ++-- src/cargo/core/summary.rs | 3 +- src/cargo/lib.rs | 12 +-- src/cargo/ops/cargo_compile.rs | 4 +- src/cargo/ops/cargo_new.rs | 6 +- src/cargo/ops/cargo_package.rs | 4 +- src/cargo/ops/cargo_rustc/custom_build.rs | 17 +-- src/cargo/ops/cargo_rustc/fingerprint.rs | 16 +-- src/cargo/ops/cargo_rustc/job.rs | 35 ++++++- src/cargo/ops/cargo_rustc/job_queue.rs | 2 +- src/cargo/ops/cargo_rustc/mod.rs | 30 +++--- src/cargo/ops/registry.rs | 8 +- src/cargo/sources/git/source.rs | 4 +- src/cargo/sources/git/utils.rs | 12 +-- src/cargo/util/config.rs | 8 +- src/cargo/util/dependency_queue.rs | 2 +- src/cargo/util/errors.rs | 24 ++--- src/cargo/util/profile.rs | 4 +- src/cargo/util/sha256.rs | 4 +- src/cargo/util/toml.rs | 2 +- src/rustversion.txt | 2 +- src/snapshots.txt | 8 ++ tests/resolve.rs | 4 +- tests/support/paths.rs | 2 +- tests/test_cargo.rs | 6 +- tests/test_cargo_bench.rs | 36 +++---- tests/test_cargo_build_auth.rs | 12 +-- tests/test_cargo_build_lib.rs | 4 +- tests/test_cargo_clean.rs | 4 +- tests/test_cargo_compile.rs | 104 +++++++++---------- tests/test_cargo_compile_custom_build.rs | 54 +++++----- tests/test_cargo_compile_git_deps.rs | 50 ++++----- tests/test_cargo_compile_old_custom_build.rs | 14 +-- tests/test_cargo_compile_path_deps.rs | 28 ++--- tests/test_cargo_compile_plugins.rs | 4 +- tests/test_cargo_cross_compile.rs | 26 ++--- tests/test_cargo_doc.rs | 16 +-- tests/test_cargo_features.rs | 38 +++---- tests/test_cargo_fetch.rs | 2 +- tests/test_cargo_freshness.rs | 4 +- tests/test_cargo_generate_lockfile.rs | 6 +- tests/test_cargo_new.rs | 26 ++--- tests/test_cargo_package.rs | 8 +- tests/test_cargo_profiles.rs | 4 +- tests/test_cargo_publish.rs | 6 +- tests/test_cargo_registry.rs | 38 +++---- tests/test_cargo_run.rs | 24 ++--- tests/test_cargo_search.rs | 2 +- tests/test_cargo_test.rs | 82 +++++++-------- tests/test_cargo_version.rs | 2 +- tests/test_shell.rs | 6 +- tests/tests.rs | 4 +- 59 files changed, 535 insertions(+), 468 deletions(-) diff --git a/.travis.install.deps.sh b/.travis.install.deps.sh index 2c3b35d4e..9f0b9c281 100755 --- a/.travis.install.deps.sh +++ b/.travis.install.deps.sh @@ -63,7 +63,7 @@ else # Don't use the bundled gcc, see rust-lang/rust#17442 rm -rf rustc/bin/rustlib/$triple/bin # Don't use bundled gcc libs, see rust-lang/rust#19519 - rm -rf rustc/bin/rustlib/$triple/libmingw*.a + rm -rf rustc/bin/rustlib/$triple/lib/libmingw*.a rm -f rust-nightly-$triple.exe fi diff --git a/Cargo.lock b/Cargo.lock index 87cebe5ba..4327f02f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,32 +2,33 @@ name = "cargo" version = "0.1.0" dependencies = [ - "curl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.15 (git+https://github.com/alexcrichton/docopt.rs?ref=update)", "flate2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", + "log 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "registry 0.1.0", - "semver 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "curl" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "curl-sys" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,14 +39,17 @@ dependencies = [ [[package]] name = "docopt" version = "0.6.15" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/alexcrichton/docopt.rs?ref=update#ad176d540d344beb932cea8aa6270b92696a48bc" +dependencies = [ + "regex 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "flate2" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "miniz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -55,12 +59,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "git2" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libgit2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -75,7 +79,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#4ae58daf0b3a853ffd [[package]] name = "libgit2-sys" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libssh2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -109,9 +113,17 @@ dependencies = [ "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "regex 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "miniz-sys" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -136,26 +148,31 @@ name = "pnacl-build-helper" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "regex" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "registry" version = "0.1.0" dependencies = [ - "curl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tar" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "time" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -163,11 +180,11 @@ dependencies = [ [[package]] name = "toml" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "url" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml index 716b87e75..644666e9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ name = "cargo" path = "src/cargo/lib.rs" [dependencies] -docopt = "0.6.14" toml = "0.1.4" url = "0.2.0" semver = "0.1.0" @@ -20,6 +19,11 @@ flate2 = "0.1.0" git2 = "0.1.0" glob = "0.1.0" time = "0.1.0" +log = "0.1.0" + +[dependencies.docopt] +git = "https://github.com/alexcrichton/docopt.rs" +branch = "update" [dev-dependencies.hamcrest] git = "https://github.com/carllerche/hamcrest-rust.git" diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index 3c52a8007..c70448da5 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -53,33 +53,33 @@ fn main() { execute_main_without_stdin(execute, true, USAGE) } -macro_rules! each_subcommand( ($macro:ident) => ({ - $macro!(bench) - $macro!(build) - $macro!(clean) - $macro!(config_for_key) - $macro!(config_list) - $macro!(doc) - $macro!(fetch) - $macro!(generate_lockfile) - $macro!(git_checkout) - $macro!(help) - $macro!(locate_project) - $macro!(login) - $macro!(new) - $macro!(owner) - $macro!(package) - $macro!(pkgid) - $macro!(publish) - $macro!(read_manifest) - $macro!(run) - $macro!(search) - $macro!(test) - $macro!(update) - $macro!(verify_project) - $macro!(version) - $macro!(yank) -}) ) +macro_rules! each_subcommand{ ($macro:ident) => ({ + $macro!(bench); + $macro!(build); + $macro!(clean); + $macro!(config_for_key); + $macro!(config_list); + $macro!(doc); + $macro!(fetch); + $macro!(generate_lockfile); + $macro!(git_checkout); + $macro!(help); + $macro!(locate_project); + $macro!(login); + $macro!(new); + $macro!(owner); + $macro!(package); + $macro!(pkgid); + $macro!(publish); + $macro!(read_manifest); + $macro!(run); + $macro!(search); + $macro!(test); + $macro!(update); + $macro!(verify_project); + $macro!(version); + $macro!(yank); +}) } /** The top-level `cargo` command handles configuration and project location @@ -116,7 +116,7 @@ fn execute(flags: Flags, shell: &mut MultiShell) -> CliResult> { args.insert(0, command.to_string()); args.insert(0, os::args()[0].clone()); - macro_rules! cmd( ($name:ident) => ( + macro_rules! cmd{ ($name:ident) => ( if command.as_slice() == stringify!($name).replace("_", "-").as_slice() { mod $name; shell.set_verbose(true); @@ -127,8 +127,8 @@ fn execute(flags: Flags, shell: &mut MultiShell) -> CliResult> { cargo::process_executed(r, shell); return Ok(None) } - ) ) - each_subcommand!(cmd) + ) } + each_subcommand!(cmd); execute_subcommand(command.as_slice(), args.as_slice(), shell); Ok(None) @@ -211,9 +211,9 @@ fn list_commands() -> TreeSet { } } - macro_rules! add_cmd( ($cmd:ident) => ({ + macro_rules! add_cmd{ ($cmd:ident) => ({ commands.insert(stringify!($cmd).replace("_", "-")); - }) ) + }) } each_subcommand!(add_cmd); commands } diff --git a/src/cargo/core/package_id.rs b/src/cargo/core/package_id.rs index d70ecd076..f763d8ccc 100644 --- a/src/cargo/core/package_id.rs +++ b/src/cargo/core/package_id.rs @@ -38,9 +38,11 @@ impl> Decodable for PackageId { let regex = Regex::new(r"^([^ ]+) ([^ ]+) \(([^\)]+)\)$").unwrap(); let captures = regex.captures(string.as_slice()).expect("invalid serialized PackageId"); - let name = captures.at(1); - let version = semver::Version::parse(captures.at(2)).ok().expect("invalid version"); - let source_id = SourceId::from_url(captures.at(3).to_string()); + let name = captures.at(1).unwrap(); + let version = captures.at(2).unwrap(); + let url = captures.at(3).unwrap(); + let version = semver::Version::parse(version).ok().expect("invalid version"); + let source_id = SourceId::from_url(url.to_string()); Ok(PackageId { inner: Arc::new(PackageIdInner { diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index c2c89da5c..ab64c622c 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -71,7 +71,7 @@ enum Kind { } impl<'a> PackageRegistry<'a> { - pub fn new<'a>(config: &'a Config<'a>) -> PackageRegistry<'a> { + pub fn new(config: &'a Config<'a>) -> PackageRegistry<'a> { PackageRegistry { sources: SourceMap::new(), source_ids: HashMap::new(), diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index 3710f8003..f6670e197 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -117,16 +117,12 @@ impl> Decodable for EncodablePackageId { let captures = regex.captures(string.as_slice()) .expect("invalid serialized PackageId"); - let name = captures.at(1); - let version = captures.at(2); + let name = captures.at(1).unwrap(); + let version = captures.at(2).unwrap(); let source = captures.at(3); - let source_id = if source == "" { - None - } else { - Some(SourceId::from_url(source.to_string())) - }; + let source_id = source.map(|s| SourceId::from_url(s.to_string())); Ok(EncodablePackageId { name: name.to_string(), diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index 18bdf650f..e2347b19d 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -1,7 +1,6 @@ use std::collections::hash_map::{HashMap, Values, MutEntries}; use std::fmt::{mod, Show, Formatter}; use std::hash; -use std::iter; use std::mem; use std::sync::Arc; use serialize::{Decodable, Decoder, Encodable, Encoder}; @@ -325,10 +324,10 @@ pub struct SourceMap<'src> { } pub type Sources<'a, 'src> = Values<'a, SourceId, Box>; -pub type SourcesMut<'a, 'src> = iter::Map<'static, (&'a SourceId, - &'a mut Box), - (&'a SourceId, &'a mut (Source+'src)), - MutEntries<'a, SourceId, Box>>; + +pub struct SourcesMut<'a, 'src: 'a> { + inner: MutEntries<'a, SourceId, Box>, +} impl<'src> SourceMap<'src> { pub fn new() -> SourceMap<'src> { @@ -374,7 +373,15 @@ impl<'src> SourceMap<'src> { } pub fn sources_mut<'a>(&'a mut self) -> SourcesMut<'a, 'src> { - self.map.iter_mut().map(|(k, v)| (k, &mut **v)) + SourcesMut { inner: self.map.iter_mut() } + } +} + +impl<'a, 'src> Iterator<(&'a SourceId, &'a mut (Source + 'src))> + for SourcesMut<'a, 'src> +{ + fn next(&mut self) -> Option<(&'a SourceId, &'a mut (Source + 'src))> { + self.inner.next().map(|(a, b)| (a, &mut **b)) } } diff --git a/src/cargo/core/summary.rs b/src/cargo/core/summary.rs index a30c65438..f750e0080 100644 --- a/src/cargo/core/summary.rs +++ b/src/cargo/core/summary.rs @@ -97,7 +97,8 @@ impl Summary { self } - pub fn map_dependencies(mut self, f: |Dependency| -> Dependency) -> Summary { + pub fn map_dependencies(mut self, f: F) -> Summary + where F: FnMut(Dependency) -> Dependency { let deps = mem::replace(&mut self.dependencies, Vec::new()); self.dependencies = deps.into_iter().map(f).collect(); self diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 0c3459de9..fb93f7b2a 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -36,14 +36,14 @@ use term::color::{BLACK, RED}; pub use util::{CargoError, CliError, CliResult, human}; -macro_rules! some( +macro_rules! some { ($e:expr) => ( match $e { Some(e) => e, None => return None } ) -) +} // Added so that the try! macro below can refer to cargo::util, while // other external importers of this macro can use it as well. @@ -54,7 +54,7 @@ mod cargo { } #[macro_export] -macro_rules! try ( +macro_rules! try { ($expr:expr) => ({ use cargo::util::FromError; match $expr.map_err(FromError::from_error) { @@ -62,16 +62,16 @@ macro_rules! try ( Err(err) => return Err(err) } }) -) +} -macro_rules! raw_try ( +macro_rules! raw_try { ($expr:expr) => ({ match $expr { Ok(val) => val, Err(err) => return Err(err) } }) -) +} pub mod core; pub mod ops; diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 9a4ddfeb6..cdfb92be0 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -218,7 +218,7 @@ fn scrape_target_config(target: &HashMap, "ar" | "linker" => { let v = try!(v.string().chain_error(|| { internal(format!("invalid configuration for key `{}`", k)) - })).ref0().to_string(); + })).0.to_string(); if k.as_slice() == "linker" { ret.linker = Some(v); } else { @@ -240,7 +240,7 @@ fn scrape_target_config(target: &HashMap, internal(format!("invalid configuration for the key \ `target.{}.{}.{}`", triple, lib_name, k)) - })).val0(); + })).0; if k.as_slice() == "rustc-flags" { let whence = format!("in `target.{}.{}.rustc-flags`", triple, lib_name); diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 3c7ac8a10..1fa52c7d1 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -147,7 +147,7 @@ fn global_config() -> CargoResult { Some(name) => { Some(try!(name.string().chain_error(|| { internal("invalid configuration for key `cargo-new.name`") - })).ref0().to_string()) + })).0.to_string()) } }; cfg.email = match cargo_new.get("email") { @@ -155,7 +155,7 @@ fn global_config() -> CargoResult { Some(email) => { Some(try!(email.string().chain_error(|| { internal("invalid configuration for key `cargo-new.email`") - })).ref0().to_string()) + })).0.to_string()) } }; cfg.git = match cargo_new.get("git") { @@ -163,7 +163,7 @@ fn global_config() -> CargoResult { Some(git) => { Some(try!(git.boolean().chain_error(|| { internal("invalid configuration for key `cargo-new.git`") - })).val0()) + })).0) } }; diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 174f72f2e..482bc8433 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -83,7 +83,7 @@ fn check_metadata(pkg: &Package, shell: &mut MultiShell) -> CargoResult<()> { )* }} } - lacking!(description, license || license_file, documentation || homepage || repository) + lacking!(description, license || license_file, documentation || homepage || repository); if !missing.is_empty() { let mut things = missing.slice_to(missing.len() - 1).connect(", "); @@ -109,7 +109,7 @@ fn tar(pkg: &Package, src: &PathSource, shell: &mut MultiShell, dst.display()))) } - try!(fs::mkdir_recursive(&dst.dir_path(), USER_DIR)) + try!(fs::mkdir_recursive(&dst.dir_path(), USER_DIR)); let tmpfile = try!(File::create(dst)); diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index ed0307486..2445a6294 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -106,7 +106,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, // // Note that this has to do some extra work just before running the command // to determine extra environment variables and such. - let work = proc(desc_tx: Sender) { + let work = move |: desc_tx: Sender| { // Make sure that OUT_DIR exists. // // If we have an old build directory, then just move it into place, @@ -175,8 +175,11 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, // Also note that a fresh build command needs to let (freshness, dirty, fresh) = try!(fingerprint::prepare_build_cmd(cx, pkg, Some(target))); - let dirty = proc(tx: Sender) { try!(work(tx.clone())); dirty(tx) }; - let fresh = proc(tx) { + let dirty = Work::new(move |tx: Sender| { + try!(work(tx.clone())); + dirty.call(tx) + }); + let fresh = Work::new(move |tx| { let (id, pkg_name, build_state, build_output) = all; let new_loc = build_output.dir_path().join("output"); let mut f = try!(File::open(&new_loc).map_err(|e| { @@ -187,8 +190,8 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, pkg_name.as_slice())); build_state.insert(id, req, output); - fresh(tx) - }; + fresh.call(tx) + }); Ok((dirty, fresh, freshness)) } @@ -248,7 +251,7 @@ impl BuildOutput { let whence = format!("build script of `{}`", pkg_name); for line in input.lines() { - let mut iter = line.splitn(1, |c: char| c == ':'); + let mut iter = line.splitn(1, |&: c: char| c == ':'); if iter.next() != Some("cargo") { // skip this line since it doesn't start with "cargo:" continue; @@ -259,7 +262,7 @@ impl BuildOutput { }; // getting the `key=value` part of the line - let mut iter = data.splitn(1, |c: char| c == '='); + let mut iter = data.splitn(1, |&: c: char| c == '='); let key = iter.next(); let value = iter.next(); let (key, value) = match (key, value) { diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 455d5f44b..1075f8b7f 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -134,7 +134,7 @@ pub fn prepare_build_cmd(cx: &mut Context, pkg: &Package, let kind = Kind::Target; if pkg.get_manifest().get_build().len() == 0 && target.is_none() { - return Ok((Fresh, proc(_) Ok(()), proc(_) Ok(()))) + return Ok((Fresh, Work::noop(), Work::noop())); } let new = dir(cx, pkg, kind); let loc = new.join("build"); @@ -164,18 +164,18 @@ pub fn prepare_init(cx: &mut Context, pkg: &Package, kind: Kind) let new1 = dir(cx, pkg, kind); let new2 = new1.clone(); - let work1 = proc(_) { + let work1 = Work::new(move |_| { if !new1.exists() { try!(fs::mkdir(&new1, io::USER_DIR)); } Ok(()) - }; - let work2 = proc(_) { + }); + let work2 = Work::new(move |_| { if !new2.exists() { try!(fs::mkdir(&new2, io::USER_DIR)); } Ok(()) - }; + }); (work1, work2) } @@ -183,13 +183,13 @@ pub fn prepare_init(cx: &mut Context, pkg: &Package, kind: Kind) /// Given the data to build and write a fingerprint, generate some Work /// instances to actually perform the necessary work. fn prepare(is_fresh: bool, loc: Path, fingerprint: String) -> Preparation { - let write_fingerprint = proc(desc_tx) { + let write_fingerprint = Work::new(move |desc_tx| { drop(desc_tx); try!(File::create(&loc).write_str(fingerprint.as_slice())); Ok(()) - }; + }); - (if is_fresh {Fresh} else {Dirty}, write_fingerprint, proc(_) Ok(())) + (if is_fresh {Fresh} else {Dirty}, write_fingerprint, Work::noop()) } /// Return the (old, new) location for fingerprints for a package diff --git a/src/cargo/ops/cargo_rustc/job.rs b/src/cargo/ops/cargo_rustc/job.rs index 889932a1a..a76f3039e 100644 --- a/src/cargo/ops/cargo_rustc/job.rs +++ b/src/cargo/ops/cargo_rustc/job.rs @@ -4,7 +4,34 @@ pub struct Job { dirty: Work, fresh: Work } /// Each proc should send its description before starting. /// It should send either once or close immediatly. -pub type Work = proc(Sender):Send -> CargoResult<()>; +pub struct Work { + inner: Box, CargoResult<()>> + Send>, +} + +trait FnBox { + fn call_box(self: Box, a: A) -> R; +} + +impl R> FnBox for F { + fn call_box(self: Box, a: A) -> R { + (*self)(a) + } +} + +impl Work { + pub fn new(f: F) -> Work + where F: FnOnce(Sender) -> CargoResult<()> + Send { + Work { inner: box f } + } + + pub fn noop() -> Work { + Work::new(|_| Ok(())) + } + + pub fn call(self, tx: Sender) -> CargoResult<()> { + self.inner.call_box(tx) + } +} impl Job { /// Create a new job representing a unit of work. @@ -20,15 +47,15 @@ impl Job { /// describe itself to the console. pub fn noop(_dirty: Work, fresh: Work) -> Job { - Job { dirty: proc(_) Ok(()), fresh: fresh } + Job { dirty: Work::noop(), fresh: fresh } } /// Consumes this job by running it, returning the result of the /// computation. pub fn run(self, fresh: Freshness, tx: Sender) -> CargoResult<()> { match fresh { - Fresh => (self.fresh)(tx), - Dirty => (self.dirty)(tx), + Fresh => self.fresh.call(tx), + Dirty => self.dirty.call(tx), } } } diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 221dbdec6..07ddf302c 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -182,7 +182,7 @@ impl<'a, 'b> JobQueue<'a, 'b> { let my_tx = self.tx.clone(); let id = id.clone(); let (desc_tx, desc_rx) = channel(); - self.pool.execute(proc() { + self.pool.execute(move|| { my_tx.send((id, stage, fresh, job.run(fresh, desc_tx))); }); // only the first message of each job is processed diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 8f8056cda..c08e060c6 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -226,10 +226,10 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, let (freshness, dirty, fresh) = try!(fingerprint::prepare_target(cx, pkg, target, kind)); - let dirty = proc(desc_tx: Sender) { - try!(work(desc_tx.clone())); - dirty(desc_tx) - }; + let dirty = Work::new(move |desc_tx: Sender| { + try!(work.call(desc_tx.clone())); + dirty.call(desc_tx) + }); dst.push((job(dirty, fresh), freshness)); } @@ -296,13 +296,15 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, 1 => pkg.get_manifest().get_build()[0].to_string(), _ => format!("custom build commands"), }; - let dirty = proc(desc_tx: Sender) { + let dirty = Work::new(move |desc_tx: Sender| { if desc.len() > 0 { desc_tx.send_opt(desc).ok(); } - for cmd in build_cmds.into_iter() { try!(cmd(desc_tx.clone())) } - dirty(desc_tx) - }; + for cmd in build_cmds.into_iter() { + try!(cmd.call(desc_tx.clone())) + } + dirty.call(desc_tx) + }); jobs.enqueue(pkg, Stage::BuildCustomBuild, vec![]); jobs.enqueue(pkg, Stage::RunCustomBuild, vec![(job(dirty, fresh), freshness)]); @@ -371,7 +373,7 @@ fn compile_custom_old(pkg: &Package, cmd: &str, } let pkg = pkg.to_string(); - Ok(proc(desc_tx: Sender) { + Ok(Work::new(move |desc_tx: Sender| { desc_tx.send_opt(p.to_string()).ok(); if first && !output.exists() { try!(fs::mkdir(&output, USER_RWX).chain_error(|| { @@ -384,7 +386,7 @@ fn compile_custom_old(pkg: &Package, cmd: &str, e.concrete().mark_human() })); Ok(()) - }) + })) } fn rustc(package: &Package, target: &Target, @@ -443,7 +445,7 @@ fn rustc(package: &Package, target: &Target, t.is_lib() }); - Ok((proc(desc_tx: Sender) { + Ok((Work::new(move |desc_tx: Sender| { let mut rustc = rustc; // Only at runtime have we discovered what the extra -L and -l @@ -479,7 +481,7 @@ fn rustc(package: &Package, target: &Target, Ok(()) - }, kind)) + }), kind)) }).collect() } @@ -539,7 +541,7 @@ fn rustdoc(package: &Package, target: &Target, let primary = package.get_package_id() == cx.resolve.root(); let name = package.get_name().to_string(); let desc = rustdoc.to_string(); - Ok(proc(desc_tx: Sender) { + Ok(Work::new(move |desc_tx: Sender| { desc_tx.send(desc); if primary { try!(rustdoc.exec().chain_error(|| { @@ -559,7 +561,7 @@ fn rustdoc(package: &Package, target: &Target, })) } Ok(()) - }) + })) } fn build_base_args(cx: &Context, diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 3886b4d6c..e793a06ca 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -140,7 +140,7 @@ pub fn registry_configuration() -> CargoResult { Some(index) => { Some(try!(index.string().chain_error(|| { internal("invalid configuration for key `index`") - })).ref0().to_string()) + })).0.to_string()) } }; let token = match registry.get("token") { @@ -148,7 +148,7 @@ pub fn registry_configuration() -> CargoResult { Some(token) => { Some(try!(token.string().chain_error(|| { internal("invalid configuration for key `token`") - })).ref0().to_string()) + })).0.to_string()) } }; Ok(RegistryConfig { index: index, token: token }) @@ -201,7 +201,7 @@ pub fn http_proxy() -> CargoResult> { Some(proxy) => { return Ok(Some(try!(proxy.string().chain_error(|| { internal("invalid configuration for key `http.proxy`") - })).ref0().to_string())) + })).0.to_string())) } None => {}, } @@ -374,7 +374,7 @@ pub fn search(query: &str, shell: &mut MultiShell, index: Option) -> Car let space = String::from_char( description_margin - name.len(), ' '); - name + space + desc + name.to_string() + space.as_slice() + desc.as_slice() } None => name }; diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index cce8cb212..2e7fb50b9 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -24,8 +24,8 @@ pub struct GitSource<'a, 'b:'a> { } impl<'a, 'b> GitSource<'a, 'b> { - pub fn new<'a, 'b>(source_id: &SourceId, - config: &'a Config<'b>) -> GitSource<'a, 'b> { + pub fn new(source_id: &SourceId, + config: &'a Config<'b>) -> GitSource<'a, 'b> { assert!(source_id.is_git(), "id is not git, id={}", source_id); let reference = match source_id.git_reference() { diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 38e23bc8a..5631af7f4 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -227,9 +227,9 @@ impl GitDatabase { } impl<'a> GitCheckout<'a> { - fn new<'a>(path: &Path, database: &'a GitDatabase, revision: GitRevision, - repo: git2::Repository) - -> GitCheckout<'a> + fn new(path: &Path, database: &'a GitDatabase, revision: GitRevision, + repo: git2::Repository) + -> GitCheckout<'a> { GitCheckout { location: path.clone(), @@ -239,9 +239,9 @@ impl<'a> GitCheckout<'a> { } } - fn clone_into<'a>(into: &Path, database: &'a GitDatabase, - revision: GitRevision) - -> CargoResult> + fn clone_into(into: &Path, database: &'a GitDatabase, + revision: GitRevision) + -> CargoResult> { let repo = try!(GitCheckout::clone_repo(database.get_path(), into)); let checkout = GitCheckout::new(into, database, revision, repo); diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index f49ce8544..a796bb380 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -26,9 +26,9 @@ pub struct Config<'a> { } impl<'a> Config<'a> { - pub fn new<'a>(shell: &'a mut MultiShell, - jobs: Option, - target: Option) -> CargoResult> { + pub fn new(shell: &'a mut MultiShell, + jobs: Option, + target: Option) -> CargoResult> { if jobs == Some(0) { return Err(human("jobs must be at least 1")) } @@ -134,7 +134,7 @@ impl> Encodable for ConfigValue { match *self { CV::String(ref string, _) => string.encode(s), CV::List(ref list) => { - let list: Vec<&string::String> = list.iter().map(|s| s.ref0()).collect(); + let list: Vec<&string::String> = list.iter().map(|s| &s.0).collect(); list.encode(s) } CV::Table(ref table) => table.encode(s), diff --git a/src/cargo/util/dependency_queue.rs b/src/cargo/util/dependency_queue.rs index 3f2414e18..8e868b4a4 100644 --- a/src/cargo/util/dependency_queue.rs +++ b/src/cargo/util/dependency_queue.rs @@ -127,7 +127,7 @@ impl, V> DependencyQueue { if fresh == Dirty { self.dirty.insert(dep.clone()); } - assert!(self.dep_map[*dep].mut0().remove(key)); + assert!(self.dep_map[*dep].0.remove(key)); } } } diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index 935a8ef4b..32fcf1e87 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -37,7 +37,7 @@ impl FromError for Box { } } -macro_rules! from_error ( +macro_rules! from_error { ($ty:ty) => { impl FromError<$ty> for $ty { fn from_error(error: $ty) -> $ty { @@ -45,7 +45,7 @@ macro_rules! from_error ( } } } -) +} impl Show for Box { fn fmt(&self, f: &mut Formatter) -> fmt::Result { @@ -99,13 +99,13 @@ impl CargoError for IoError { fn description(&self) -> String { self.to_string() } } -from_error!(IoError) +from_error!(IoError); impl CargoError for TomlError { fn description(&self) -> String { self.to_string() } } -from_error!(TomlError) +from_error!(TomlError); impl CargoError for fmt::Error { fn description(&self) -> String { @@ -113,19 +113,19 @@ impl CargoError for fmt::Error { } } -from_error!(fmt::Error) +from_error!(fmt::Error); impl CargoError for curl::ErrCode { fn description(&self) -> String { self.to_string() } } -from_error!(curl::ErrCode) +from_error!(curl::ErrCode); impl CargoError for json::DecoderError { fn description(&self) -> String { self.to_string() } } -from_error!(json::DecoderError) +from_error!(json::DecoderError); pub struct ProcessError { pub msg: String, @@ -135,7 +135,7 @@ pub struct ProcessError { pub cause: Option> } -from_error!(ProcessError) +from_error!(ProcessError); impl Show for ProcessError { fn fmt(&self, f: &mut Formatter) -> fmt::Result { @@ -247,7 +247,7 @@ impl CargoError for CliError { } } -from_error!(CliError) +from_error!(CliError); impl CargoError for docopt::Error { fn description(&self) -> String { @@ -269,19 +269,19 @@ impl CargoError for docopt::Error { fn is_human(&self) -> bool { true } } -from_error!(docopt::Error) +from_error!(docopt::Error); impl CargoError for url::ParseError { fn description(&self) -> String { self.to_string() } } -from_error!(url::ParseError) +from_error!(url::ParseError); impl CargoError for git2::Error { fn description(&self) -> String { self.to_string() } } -from_error!(git2::Error) +from_error!(git2::Error); impl CliError { pub fn new(error: S, code: uint) -> CliError { diff --git a/src/cargo/util/profile.rs b/src/cargo/util/profile.rs index 17ec7700b..c82c07cf3 100644 --- a/src/cargo/util/profile.rs +++ b/src/cargo/util/profile.rs @@ -4,8 +4,8 @@ use std::fmt::Show; use time; use std::cell::RefCell; -thread_local!(static PROFILE_STACK: RefCell> = RefCell::new(Vec::new())) -thread_local!(static MESSAGES: RefCell> = RefCell::new(Vec::new())) +thread_local!(static PROFILE_STACK: RefCell> = RefCell::new(Vec::new())); +thread_local!(static MESSAGES: RefCell> = RefCell::new(Vec::new())); type Message = (uint, u64, String); diff --git a/src/cargo/util/sha256.rs b/src/cargo/util/sha256.rs index 19a24a8dc..88419ae15 100644 --- a/src/cargo/util/sha256.rs +++ b/src/cargo/util/sha256.rs @@ -107,11 +107,11 @@ mod imp { fn CryptDestroyHash(hHash: HCRYPTHASH) -> BOOL; } - macro_rules! call( ($e:expr) => ({ + macro_rules! call{ ($e:expr) => ({ if $e == 0 { panic!("failed {}: {}", stringify!($e), os::last_os_error()) } - }) ) + }) } pub struct Sha256 { hcryptprov: HCRYPTPROV, diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 6bcbdef21..762e32d13 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -133,7 +133,7 @@ pub fn to_manifest(contents: &[u8], add_unused_keys(m, v, if key.len() == 0 { k.clone() } else { - key + "." + k.as_slice() + key.clone() + "." + k.as_slice() }) } } diff --git a/src/rustversion.txt b/src/rustversion.txt index 75053c92f..e4c3aa63c 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2014-12-15 +2014-12-19 diff --git a/src/snapshots.txt b/src/snapshots.txt index 196e35952..c20fbde3f 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,11 @@ +2014-12-20 + linux-i386 1cccab5a6ac8e73472bf78cdce019cd1a60d4638 + linux-x86_64 53c176fcda0a40fb77b901303c443de3dce3e58d + macos-i386 bbc23c78ca4307efa6250552a097e6b2ccfe2cc3 + macos-x86_64 4f97a30408c99858ad2b7a7f6edfe3d5b8f0ff3f + winnt-i386 5d77cd604b011100398023e8dc3d98c173247874 + winnt-x86_64 1290dcc2a51e99027803d641c08299abe1265158 + 2014-12-18 linux-i386 30eec547395093ab9c6a0587a3210666b9272815 linux-x86_64 20d13252996838680f4356a7addd75403bb11aec diff --git a/tests/resolve.rs b/tests/resolve.rs index eede8d6eb..7fe4ffd53 100644 --- a/tests/resolve.rs +++ b/tests/resolve.rs @@ -58,7 +58,7 @@ impl ToPkgId for (&'static str, &'static str) { } } -macro_rules! pkg( +macro_rules! pkg { ($pkgid:expr => [$($deps:expr),+]) => ({ let d: Vec = vec![$($deps.to_dep()),+]; @@ -68,7 +68,7 @@ macro_rules! pkg( ($pkgid:expr) => ( Summary::new($pkgid.to_pkgid(), Vec::new(), HashMap::new()).unwrap() ) -) +} fn registry_loc() -> SourceId { let remote = "http://example.com".to_url().unwrap(); diff --git a/tests/support/paths.rs b/tests/support/paths.rs index 0dde54635..f5b701dcd 100644 --- a/tests/support/paths.rs +++ b/tests/support/paths.rs @@ -7,7 +7,7 @@ use cargo::util::realpath; static CARGO_INTEGRATION_TEST_DIR : &'static str = "cit"; static NEXT_ID: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT; -thread_local!(static TASK_ID: uint = NEXT_ID.fetch_add(1, atomic::SeqCst)) +thread_local!(static TASK_ID: uint = NEXT_ID.fetch_add(1, atomic::SeqCst)); pub fn root() -> Path { let path = os::self_exe_path().unwrap() diff --git a/tests/test_cargo.rs b/tests/test_cargo.rs index 513c698b2..773754d69 100644 --- a/tests/test_cargo.rs +++ b/tests/test_cargo.rs @@ -46,7 +46,7 @@ test!(list_commands_looks_at_path { let output = output.exec_with_output().assert(); let output = str::from_utf8(output.output.as_slice()).assert(); assert!(output.contains("\n 1\n"), "missing 1: {}", output); -}) +}); test!(find_closest_biuld_to_build { let pr = process(cargo_dir().join("cargo")).unwrap() @@ -60,7 +60,7 @@ test!(find_closest_biuld_to_build { Did you mean `build`? ")); -}) +}); // if a subcommand is more than 3 edit distance away, we don't make a suggestion test!(find_closest_dont_correct_nonsense { @@ -72,4 +72,4 @@ test!(find_closest_dont_correct_nonsense { execs().with_status(127) .with_stderr("No such subcommand ")); -}) +}); diff --git a/tests/test_cargo_bench.rs b/tests/test_cargo_bench.rs index 18d92de92..ee957e80f 100644 --- a/tests/test_cargo_bench.rs +++ b/tests/test_cargo_bench.rs @@ -48,7 +48,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", COMPILING, p.url(), RUNNING))); -}) +}); test!(bench_target_name { let prj = project("foo") @@ -89,7 +89,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured assert_that(prj.cargo_process("bench").arg("--bench").arg("bin2"), execs().with_status(0).with_stdout(expected_stdout.as_slice())); -}) +}); test!(cargo_bench_verbose { let p = project("foo") @@ -113,7 +113,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", compiling = COMPILING, url = p.url(), running = RUNNING))); -}) +}); test!(many_similar_names { let p = project("foo") @@ -145,7 +145,7 @@ test!(many_similar_names { assert!(output.contains("test bin_bench"), "bin_bench missing\n{}", output); assert!(output.contains("test lib_bench"), "lib_bench missing\n{}", output); assert!(output.contains("test bench_bench"), "bench_bench missing\n{}", output); -}) +}); test!(cargo_bench_failing_test { let p = project("foo") @@ -186,7 +186,7 @@ task '
' panicked at 'assertion failed: \ `hello`, right: `nope`)', src{sep}foo.rs:13 ", sep = path::SEP)) .with_status(101)); -}) +}); test!(bench_with_lib_dep { let p = project("foo") @@ -242,7 +242,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", COMPILING, p.url(), running = RUNNING))) -}) +}); test!(bench_with_deep_lib_dep { let p = project("bar") @@ -295,7 +295,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(external_bench_explicit { let p = project("foo") @@ -343,7 +343,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", COMPILING, p.url(), running = RUNNING))) -}) +}); test!(external_bench_implicit { let p = project("foo") @@ -388,7 +388,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", COMPILING, p.url(), running = RUNNING))) -}) +}); test!(dont_run_examples { let p = project("foo") @@ -405,7 +405,7 @@ test!(dont_run_examples { "#); assert_that(p.cargo_process("bench"), execs().with_status(0)); -}) +}); test!(pass_through_command_line { let p = project("foo") @@ -451,7 +451,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); // Regression test for running cargo-bench twice with // tests in an rlib @@ -473,7 +473,7 @@ test!(cargo_bench_twice { assert_that(p.process(cargo_dir().join("cargo")).arg("bench"), execs().with_status(0)); } -}) +}); test!(lib_bin_same_name { let p = project("foo") @@ -519,7 +519,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", COMPILING, p.url(), running = RUNNING))) -}) +}); test!(lib_with_standard_name { let p = project("foo") @@ -569,7 +569,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(lib_with_standard_name2 { let p = project("foo") @@ -611,7 +611,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(bin_there_for_integration { let p = project("foo") @@ -644,7 +644,7 @@ test!(bin_there_for_integration { assert!(output.contains("bench_bench ... bench: 0 ns/iter (+/- 0)"), "no bench_bench\n{}", output); -}) +}); #[cfg(not(windows))] // FIXME(#456) test!(bench_dylib { @@ -741,7 +741,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", fresh = FRESH, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(bench_twice_with_build_cmd { let p = project("foo") @@ -785,4 +785,4 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ", running = RUNNING))); -}) +}); diff --git a/tests/test_cargo_build_auth.rs b/tests/test_cargo_build_auth.rs index f2a002f1e..80deaa216 100644 --- a/tests/test_cargo_build_auth.rs +++ b/tests/test_cargo_build_auth.rs @@ -38,7 +38,7 @@ test!(http_auth_offered { .collect() } - spawn(proc() { + spawn(move|| { let mut s = BufferedStream::new(a.accept().unwrap()); let req = headers(&mut s); s.write(b"\ @@ -123,7 +123,7 @@ Caused by: addr = addr))); rx.recv(); -}) +}); // Boy, sure would be nice to have a TLS implementation in rust! test!(https_something_happens { @@ -133,7 +133,7 @@ test!(https_something_happens { let a2 = a.clone(); let _c = Closer { a: a2 }; let (tx, rx) = channel(); - spawn(proc() { + spawn(move|| { drop(a.accept().unwrap()); tx.send(()); @@ -176,7 +176,7 @@ Caused by: }))); rx.recv(); -}) +}); // Boy, sure would be nice to have an SSH implementation in rust! test!(ssh_something_happens { @@ -186,7 +186,7 @@ test!(ssh_something_happens { let a2 = a.clone(); let _c = Closer { a: a2 }; let (tx, rx) = channel(); - spawn(proc() { + spawn(move|| { drop(a.accept().unwrap()); tx.send(()); @@ -223,4 +223,4 @@ Caused by: addr = addr))); rx.recv(); -}) +}); diff --git a/tests/test_cargo_build_lib.rs b/tests/test_cargo_build_lib.rs index 2b3c1b302..aab74fd11 100644 --- a/tests/test_cargo_build_lib.rs +++ b/tests/test_cargo_build_lib.rs @@ -40,7 +40,7 @@ test!(build_lib_only { execs() .with_status(0) .with_stdout(verbose_output_for_lib(&p))); -}) +}); test!(build_with_no_lib { @@ -54,4 +54,4 @@ test!(build_with_no_lib { execs() .with_status(101) .with_stderr("There is no lib to build, remove `--lib` flag")); -}) +}); diff --git a/tests/test_cargo_clean.rs b/tests/test_cargo_clean.rs index c45035a3d..ca6b8a17f 100644 --- a/tests/test_cargo_clean.rs +++ b/tests/test_cargo_clean.rs @@ -15,7 +15,7 @@ test!(cargo_clean_simple { assert_that(p.process(cargo_dir().join("cargo")).arg("clean"), execs().with_status(0)); assert_that(&p.build_dir(), is_not(existing_dir())); -}) +}); test!(different_dir { let p = project("foo") @@ -30,4 +30,4 @@ test!(different_dir { .cwd(p.root().join("src")), execs().with_status(0).with_stdout("")); assert_that(&p.build_dir(), is_not(existing_dir())); -}) +}); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index b87f08036..817bcc251 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -22,7 +22,7 @@ test!(cargo_compile_simple { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("i am foo\n")); -}) +}); test!(cargo_compile_manifest_path { let p = project("foo") @@ -34,7 +34,7 @@ test!(cargo_compile_manifest_path { .cwd(p.root().dir_path()), execs().with_status(0)); assert_that(&p.bin("foo"), existing_file()); -}) +}); test!(cargo_compile_with_invalid_manifest { let p = project("foo") @@ -45,7 +45,7 @@ test!(cargo_compile_with_invalid_manifest { .with_status(101) .with_stderr("Cargo.toml is not a valid manifest\n\n\ No `package` or `project` section found.\n")) -}) +}); test!(cargo_compile_with_invalid_manifest2 { let p = project("foo") @@ -59,7 +59,7 @@ test!(cargo_compile_with_invalid_manifest2 { .with_status(101) .with_stderr("could not parse input TOML\n\ Cargo.toml:3:19-3:20 expected a value\n\n")) -}) +}); test!(cargo_compile_with_invalid_manifest3 { let p = project("foo") @@ -77,7 +77,7 @@ test!(cargo_compile_with_invalid_manifest3 { .with_status(101) .with_stderr("could not parse input TOML\n\ src[..]Cargo.toml:1:5-1:6 expected a value\n\n")) -}) +}); test!(cargo_compile_with_invalid_version { let p = project("foo") @@ -95,7 +95,7 @@ test!(cargo_compile_with_invalid_version { cannot parse '1.0' as a semver for the key \ `project.version`\n")) -}) +}); test!(cargo_compile_without_manifest { let tmpdir = TempDir::new("cargo").unwrap(); @@ -106,7 +106,7 @@ test!(cargo_compile_without_manifest { .with_status(102) .with_stderr("Could not find Cargo.toml in this directory or any \ parent directory\n")); -}) +}); test!(cargo_compile_with_invalid_code { let p = project("foo") @@ -125,7 +125,7 @@ Could not compile `foo`. To learn more, run the command again with --verbose.\n", filename = format!("src{}foo.rs", path::SEP)).as_slice())); assert_that(&p.root().join("Cargo.lock"), existing_file()); -}) +}); test!(cargo_compile_with_invalid_code_in_deps { let p = project("foo") @@ -150,7 +150,7 @@ test!(cargo_compile_with_invalid_code_in_deps { bar.build(); baz.build(); assert_that(p.cargo_process("build"), execs().with_status(101)); -}) +}); test!(cargo_compile_with_warnings_in_the_root_package { let p = project("foo") @@ -165,7 +165,7 @@ on by default {filename}:1 fn main() {{}} fn dead() {{}} ^~~~~~~~~~~~ ", filename = format!("src{}foo.rs", path::SEP).as_slice()))); -}) +}); test!(cargo_compile_with_warnings_in_a_dep_package { let mut p = project("foo"); @@ -223,7 +223,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("test passed\n")); -}) +}); test!(cargo_compile_with_nested_deps_inferred { let p = project("foo") @@ -281,7 +281,7 @@ test!(cargo_compile_with_nested_deps_inferred { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("test passed\n")); -}) +}); test!(cargo_compile_with_nested_deps_correct_bin { let p = project("foo") @@ -339,7 +339,7 @@ test!(cargo_compile_with_nested_deps_correct_bin { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("test passed\n")); -}) +}); test!(cargo_compile_with_nested_deps_shorthand { let p = project("foo") @@ -406,7 +406,7 @@ test!(cargo_compile_with_nested_deps_shorthand { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("test passed\n")); -}) +}); test!(cargo_compile_with_nested_deps_longhand { let p = project("foo") @@ -473,7 +473,7 @@ test!(cargo_compile_with_nested_deps_longhand { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("test passed\n")); -}) +}); // Check that Cargo gives a sensible error if a dependency can't be found // because of a name mismatch. @@ -504,7 +504,7 @@ r#"no package named `notquitebar` found (required by `foo`) location searched: {proj_dir} version required: * "#, proj_dir = p.url()))); -}) +}); // test!(compiling_project_with_invalid_manifest) @@ -553,7 +553,7 @@ test!(crate_version_env_vars { assert_that(p.process(cargo_dir().join("cargo")).arg("test"), execs().with_status(0)); -}) +}); // this is testing that src/.rs still works (for now) test!(many_crate_types_old_style_lib_location { @@ -592,7 +592,7 @@ test!(many_crate_types_old_style_lib_location { assert!(file0.ends_with(".rlib") || file1.ends_with(".rlib")); assert!(file0.ends_with(os::consts::DLL_SUFFIX) || file1.ends_with(os::consts::DLL_SUFFIX)); -}) +}); test!(many_crate_types_correct { let mut p = project("foo"); @@ -630,7 +630,7 @@ test!(many_crate_types_correct { assert!(file0.ends_with(".rlib") || file1.ends_with(".rlib")); assert!(file0.ends_with(os::consts::DLL_SUFFIX) || file1.ends_with(os::consts::DLL_SUFFIX)); -}) +}); test!(unused_keys { let mut p = project("foo"); @@ -674,7 +674,7 @@ test!(unused_keys { assert_that(p.cargo_process("build"), execs().with_status(0) .with_stderr("unused manifest key: lib.build\n")); -}) +}); test!(self_dependency { let mut p = project("foo"); @@ -697,7 +697,7 @@ test!(self_dependency { .file("src/test.rs", "fn main() {}"); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); #[cfg(not(windows))] test!(ignore_broken_symlinks { @@ -712,7 +712,7 @@ test!(ignore_broken_symlinks { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("i am foo\n")); -}) +}); test!(missing_lib_and_bin { let mut p = project("foo"); @@ -728,7 +728,7 @@ test!(missing_lib_and_bin { execs().with_status(101) .with_stderr("either a [lib] or [[bin]] section \ must be present\n")); -}) +}); test!(lto_build { let mut p = project("foo"); @@ -760,7 +760,7 @@ running = RUNNING, compiling = COMPILING, sep = path::SEP, dir = p.root().display(), url = p.url(), ))); -}) +}); test!(verbose_build { let mut p = project("foo"); @@ -788,7 +788,7 @@ running = RUNNING, compiling = COMPILING, sep = path::SEP, dir = p.root().display(), url = p.url(), ))); -}) +}); test!(verbose_release_build { let mut p = project("foo"); @@ -818,7 +818,7 @@ running = RUNNING, compiling = COMPILING, sep = path::SEP, dir = p.root().display(), url = p.url(), ))); -}) +}); test!(verbose_release_build_deps { let mut p = project("foo"); @@ -880,7 +880,7 @@ test!(verbose_release_build_deps { sep = path::SEP, prefix = os::consts::DLL_PREFIX, suffix = os::consts::DLL_SUFFIX).as_slice())); -}) +}); test!(explicit_examples { let mut p = project("world"); @@ -921,7 +921,7 @@ test!(explicit_examples { execs().with_stdout("Hello, World!\n")); assert_that(process(p.bin("examples/goodbye")).unwrap(), execs().with_stdout("Goodbye, World!\n")); -}) +}); test!(implicit_examples { let mut p = project("world"); @@ -950,7 +950,7 @@ test!(implicit_examples { execs().with_stdout("Hello, World!\n")); assert_that(process(p.bin("examples/goodbye")).unwrap(), execs().with_stdout("Goodbye, World!\n")); -}) +}); test!(standard_build_no_ndebug { let p = project("world") @@ -967,7 +967,7 @@ test!(standard_build_no_ndebug { assert_that(p.cargo_process("build"), execs().with_status(0)); assert_that(process(p.bin("foo")).unwrap(), execs().with_stdout("slow\n")); -}) +}); test!(release_build_ndebug { let p = project("world") @@ -985,7 +985,7 @@ test!(release_build_ndebug { assert_that(p.cargo_process("build").arg("--release"), execs().with_status(0)); assert_that(process(p.bin("release/foo")).unwrap(), execs().with_stdout("fast\n")); -}) +}); test!(inferred_main_bin { let p = project("world") @@ -1001,7 +1001,7 @@ test!(inferred_main_bin { assert_that(p.cargo_process("build"), execs().with_status(0)); assert_that(process(p.bin("foo")).unwrap(), execs().with_status(0)); -}) +}); test!(deletion_causes_failure { let p = project("foo") @@ -1034,7 +1034,7 @@ test!(deletion_causes_failure { authors = [] "#); assert_that(p.cargo_process("build"), execs().with_status(101)); -}) +}); test!(bad_cargo_toml_in_target_dir { let p = project("world") @@ -1051,7 +1051,7 @@ test!(bad_cargo_toml_in_target_dir { assert_that(p.cargo_process("build"), execs().with_status(0)); assert_that(process(p.bin("foo")).unwrap(), execs().with_status(0)); -}) +}); test!(lib_with_standard_name { let p = project("foo") @@ -1076,7 +1076,7 @@ test!(lib_with_standard_name { ", compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(simple_staticlib { let p = project("foo") @@ -1093,7 +1093,7 @@ test!(simple_staticlib { .file("src/lib.rs", "pub fn foo() {}"); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(staticlib_rlib_and_bin { let p = project("foo") @@ -1116,7 +1116,7 @@ test!(staticlib_rlib_and_bin { }"#); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(opt_out_of_lib { let p = project("foo") @@ -1131,7 +1131,7 @@ test!(opt_out_of_lib { .file("src/lib.rs", "bad syntax") .file("src/main.rs", "fn main() {}"); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(opt_out_of_bin { let p = project("foo") @@ -1146,7 +1146,7 @@ test!(opt_out_of_bin { .file("src/lib.rs", "") .file("src/main.rs", "bad syntax"); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(single_lib { let p = project("foo") @@ -1162,7 +1162,7 @@ test!(single_lib { "#) .file("src/bar.rs", ""); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(deprecated_lib { let p = project("foo") @@ -1180,7 +1180,7 @@ test!(deprecated_lib { execs().with_status(0) .with_stderr("\ the [[lib]] section has been deprecated in favor of [lib]\n")); -}) +}); test!(freshness_ignores_excluded { let foo = project("foo") @@ -1214,7 +1214,7 @@ test!(freshness_ignores_excluded { assert_that(foo.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0) .with_stdout("")); -}) +}); test!(rebuild_preserves_out_dir { let mut build = project("builder"); @@ -1265,7 +1265,7 @@ test!(rebuild_preserves_out_dir { .with_stdout(format!("\ {compiling} foo v0.0.0 ({url}) ", compiling = COMPILING, url = foo.url()))); -}) +}); test!(dep_no_libs { let foo = project("foo") @@ -1290,7 +1290,7 @@ test!(dep_no_libs { execs().with_status(101) .with_stderr("\ Package `bar v0.0.0 ([..])` has no library targets")); -}) +}); test!(recompile_space_in_name { let foo = project("foo") @@ -1309,7 +1309,7 @@ test!(recompile_space_in_name { foo.root().move_into_the_past().assert(); assert_that(foo.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0).with_stdout("")); -}) +}); test!(ignore_bad_directories { let foo = project("foo") @@ -1325,7 +1325,7 @@ test!(ignore_bad_directories { assert_that(foo.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0)); fs::chmod(&foo.root().join("tmp"), io::USER_DIR).unwrap(); -}) +}); test!(bad_cargo_config { let foo = project("foo") @@ -1351,7 +1351,7 @@ Caused by: [..].cargo[..]config:2:20-2:21 expected `=`, but found `i` ")); -}) +}); #[cfg(target_os = "linux")] test!(cargo_platform_specific_dependency { @@ -1392,7 +1392,7 @@ test!(cargo_platform_specific_dependency { assert_that( process(p.bin("foo")).unwrap(), execs().with_stdout("test passed\n")); -}) +}); #[cfg(not(target_os = "linux"))] test!(cargo_platform_specific_dependency { @@ -1428,7 +1428,7 @@ test!(cargo_platform_specific_dependency { assert_that(p.cargo_process("build"), execs().with_status(101)); -}) +}); test!(cargo_platform_specific_dependency_wrong_platform { let p = project("foo") @@ -1469,7 +1469,7 @@ test!(cargo_platform_specific_dependency_wrong_platform { let lockfile = p.root().join("Cargo.lock"); let lockfile = File::open(&lockfile).read_to_string().assert(); assert!(lockfile.as_slice().contains("bar")) -}) +}); test!(example_bin_same_name { let p = project("foo") @@ -1495,7 +1495,7 @@ test!(example_bin_same_name { assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("examples/foo"), existing_file()); -}) +}); test!(compile_then_delete { let p = project("foo") @@ -1518,4 +1518,4 @@ test!(compile_then_delete { fs::unlink(&p.bin("foo")).unwrap(); assert_that(p.process(cargo_dir().join("cargo")).arg("run"), execs().with_status(0)); -}) +}); diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index eb3d8eef3..bcce93918 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -38,7 +38,7 @@ url = p.url(), compiling = COMPILING, running = RUNNING)) Failed to run custom build command for `foo v0.5.0 ({})` Process didn't exit successfully: `[..]build[..]build-script-build[..]` (status=101)", p.url()))); -}) +}); test!(custom_build_env_vars { let p = project("foo") @@ -111,7 +111,7 @@ test!(custom_build_env_vars { assert_that(p.cargo_process("build").arg("--features").arg("bar_feat"), execs().with_status(0)); -}) +}); test!(custom_build_script_wrong_rustc_flags { let p = project("foo") @@ -138,7 +138,7 @@ test!(custom_build_script_wrong_rustc_flags { Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`: \ `-aaa -bbb`", p.url()))); -}) +}); /* test!(custom_build_script_rustc_flags { @@ -189,7 +189,7 @@ running = RUNNING, compiling = COMPILING, sep = path::SEP, dir = p.root().display(), url = p.url(), ))); -}) +}); */ test!(links_no_build_cmd { @@ -209,7 +209,7 @@ test!(links_no_build_cmd { package `foo v0.5.0 (file://[..])` specifies that it links to `a` but does \ not have a custom build script ")); -}) +}); test!(links_duplicates { let p = project("foo") @@ -246,7 +246,7 @@ linked to by one package [..] v0.5.0 (file://[..]) [..] v0.5.0 (file://[..]) ")); -}) +}); test!(overrides_and_links { let (_, target) = ::cargo::ops::rustc_version().unwrap(); @@ -297,7 +297,7 @@ test!(overrides_and_links { [..] {running} `rustc [..] --crate-name foo [..] -L foo -L bar[..]` ", running = RUNNING).as_slice())); -}) +}); test!(unused_overrides { let (_, target) = ::cargo::ops::rustc_version().unwrap(); @@ -321,7 +321,7 @@ test!(unused_overrides { assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0)); -}) +}); test!(links_passes_env_vars { let p = project("foo") @@ -371,7 +371,7 @@ test!(links_passes_env_vars { {running} `[..]` {running} `rustc [..] --crate-name foo [..]` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); test!(only_rerun_build_script { let p = project("foo") @@ -401,7 +401,7 @@ test!(only_rerun_build_script { {running} `[..]build-script-build[..]` {running} `rustc [..] --crate-name foo [..]` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); test!(rebuild_continues_to_pass_env_vars { let a = project("a") @@ -452,7 +452,7 @@ test!(rebuild_continues_to_pass_env_vars { assert_that(p.process(cargo_dir().join("cargo")).arg("build").arg("-v"), execs().with_status(0)); -}) +}); test!(testing_and_such { let p = project("foo") @@ -512,7 +512,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured {compiling} foo v0.5.0 (file://[..]) {running} `target[..]foo` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); test!(propagation_of_l_flags { let (_, target) = ::cargo::ops::rustc_version().unwrap(); @@ -570,7 +570,7 @@ test!(propagation_of_l_flags { {compiling} foo v0.5.0 (file://[..]) {running} `rustc [..] --crate-name foo [..] -L bar -L foo` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); test!(build_deps_simple { let p = project("foo") @@ -606,7 +606,7 @@ test!(build_deps_simple { {running} `[..]foo-[..]build-script-build[..]` {running} `rustc [..] --crate-name foo [..]` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); test!(build_deps_not_for_normal { let (_, target) = ::cargo::ops::rustc_version().unwrap(); @@ -645,7 +645,7 @@ Could not compile `foo`. Caused by: Process didn't exit successfully: [..] ")); -}) +}); test!(build_cmd_with_a_build_cmd { let p = project("foo") @@ -708,7 +708,7 @@ test!(build_cmd_with_a_build_cmd { --out-dir [..]target --dep-info [..]fingerprint[..]dep-lib-foo \ -L [..]target -L [..]target[..]deps` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); test!(out_dir_is_preserved { let p = project("foo") @@ -755,7 +755,7 @@ test!(out_dir_is_preserved { File::create(&p.root().join("foo")).unwrap(); assert_that(p.process(cargo_dir().join("cargo")).arg("build").arg("-v"), execs().with_status(0)); -}) +}); test!(output_separate_lines { let p = project("foo") @@ -781,7 +781,7 @@ test!(output_separate_lines { {running} `[..]foo-[..]build-script-build[..]` {running} `rustc [..] --crate-name foo [..] -L foo -l foo:static` ", compiling = COMPILING, running = RUNNING).as_slice())); -}) +}); #[cfg(not(windows))] // FIXME(#867) test!(code_generation { @@ -794,7 +794,7 @@ test!(code_generation { build = "build.rs" "#) .file("src/main.rs", r#" - include!(concat!(env!("OUT_DIR"), "/hello.rs")) + include!(concat!(env!("OUT_DIR"), "/hello.rs")); fn main() { println!("{}", message()); @@ -824,7 +824,7 @@ Hello, World! assert_that(p.cargo_process("test"), execs().with_status(0)); -}) +}); test!(release_with_build_script { let p = project("foo") @@ -842,7 +842,7 @@ test!(release_with_build_script { assert_that(p.cargo_process("build").arg("-v").arg("--release"), execs().with_status(0)); -}) +}); test!(build_script_only { let p = project("foo") @@ -858,7 +858,7 @@ test!(build_script_only { execs().with_status(101) .with_stderr("either a [lib] or [[bin]] section must \ be present")); -}) +}); test!(shared_dep_with_a_build_script { let p = project("foo") @@ -898,7 +898,7 @@ test!(shared_dep_with_a_build_script { .file("b/src/lib.rs", ""); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(transitive_dep_host { let p = project("foo") @@ -940,7 +940,7 @@ test!(transitive_dep_host { .file("b/src/lib.rs", ""); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(test_a_lib_with_a_build_command { let p = project("foo") @@ -952,7 +952,7 @@ test!(test_a_lib_with_a_build_command { build = "build.rs" "#) .file("src/lib.rs", r#" - include!(concat!(env!("OUT_DIR"), "/foo.rs")) + include!(concat!(env!("OUT_DIR"), "/foo.rs")); /// ``` /// foo::bar(); @@ -974,7 +974,7 @@ test!(test_a_lib_with_a_build_command { "#); assert_that(p.cargo_process("test"), execs().with_status(0)); -}) +}); test!(test_dev_dep_build_script { let p = project("foo") @@ -999,4 +999,4 @@ test!(test_dev_dep_build_script { .file("a/src/lib.rs", ""); assert_that(p.cargo_process("test"), execs().with_status(0)); -}) +}); diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index af754adba..51cd2bcea 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -132,7 +132,7 @@ test!(cargo_compile_simple_git_dep { assert_that( cargo::util::process(project.bin("foo")).unwrap(), execs().with_stdout("hello world\n")); -}) +}); test!(cargo_compile_git_dep_branch { let project = project("foo"); @@ -199,7 +199,7 @@ test!(cargo_compile_git_dep_branch { assert_that( cargo::util::process(project.bin("foo")).unwrap(), execs().with_stdout("hello world\n")); -}) +}); test!(cargo_compile_git_dep_tag { let project = project("foo"); @@ -269,7 +269,7 @@ test!(cargo_compile_git_dep_tag { assert_that( cargo::util::process(project.bin("foo")).unwrap(), execs().with_stdout("hello world\n")); -}) +}); test!(cargo_compile_with_nested_paths { let git_project = git_repo("dep1", |project| { @@ -344,7 +344,7 @@ test!(cargo_compile_with_nested_paths { assert_that( cargo::util::process(p.bin("parent")).unwrap(), execs().with_stdout("hello world\n")); -}) +}); test!(cargo_compile_with_meta_package { let git_project = git_repo("meta-dep", |project| { @@ -417,7 +417,7 @@ test!(cargo_compile_with_meta_package { assert_that( cargo::util::process(p.bin("parent")).unwrap(), execs().with_stdout("this is dep1 this is dep2\n")); -}) +}); test!(cargo_compile_with_short_ssh_git { let url = "git@github.com:a/dep"; @@ -445,7 +445,7 @@ test!(cargo_compile_with_short_ssh_git { .with_stdout("") .with_stderr(format!("Cargo.toml is not a valid manifest\n\n\ invalid url `{}`: relative URL without a base\n", url))); -}) +}); test!(two_revs_same_deps { let bar = git_repo("meta-dep", |project| { @@ -514,7 +514,7 @@ test!(two_revs_same_deps { execs().with_status(0)); assert_that(&foo.bin("foo"), existing_file()); assert_that(foo.process(foo.bin("foo")), execs().with_status(0)); -}) +}); test!(recompilation { let git_project = git_repo("bar", |project| { @@ -613,7 +613,7 @@ test!(recompilation { assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_stdout(format!("{} foo v0.5.0 ({})\n", COMPILING, p.url()))); -}) +}); test!(update_with_shared_deps { let git_project = git_repo("bar", |project| { @@ -731,7 +731,7 @@ test!(update_with_shared_deps { execs().with_stdout(format!("{} git repository `{}`", UPDATING, git_project.url()))); -}) +}); test!(dep_with_submodule { let project = project("foo"); @@ -773,7 +773,7 @@ test!(dep_with_submodule { assert_that(project.cargo_process("build"), execs().with_stderr("").with_status(0)); -}) +}); test!(two_deps_only_update_one { let project = project("foo"); @@ -840,7 +840,7 @@ test!(two_deps_only_update_one { .with_stdout(format!("{} git repository `{}`\n", UPDATING, git1.url())) .with_stderr("")); -}) +}); test!(stale_cached_version { let bar = git_repo("meta-dep", |project| { @@ -910,7 +910,7 @@ test!(stale_cached_version { {compiling} foo v0.0.0 ({foo}) ", updating = UPDATING, compiling = COMPILING, bar = bar.url(), foo = foo.url()))); assert_that(foo.process(foo.bin("foo")), execs().with_status(0)); -}) +}); test!(dep_with_changed_submodule { let project = project("foo"); @@ -1009,7 +1009,7 @@ test!(dep_with_changed_submodule { compiling = COMPILING, running = RUNNING)) .with_stderr("") .with_status(0)); -}) +}); test!(dev_deps_with_testing { let p2 = git_repo("bar", |project| { @@ -1068,7 +1068,7 @@ test tests::foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, running = RUNNING))); -}) +}); test!(git_build_cmd_freshness { let foo = git_repo("foo", |project| { @@ -1106,7 +1106,7 @@ test!(git_build_cmd_freshness { assert_that(foo.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0) .with_stdout("")); -}) +}); test!(git_name_not_always_needed { let p2 = git_repo("bar", |project| { @@ -1145,7 +1145,7 @@ test!(git_name_not_always_needed { {updating} git repository `{bar}` {compiling} foo v0.5.0 ({url}) ", updating = UPDATING, compiling = COMPILING, url = p.url(), bar = p2.url()))); -}) +}); test!(git_repo_changing_no_rebuild { let bar = git_repo("bar", |project| { @@ -1209,7 +1209,7 @@ test!(git_repo_changing_no_rebuild { // even though the git repo has changed. assert_that(p1.process(cargo_dir().join("cargo")).arg("build"), execs().with_stdout("")); -}) +}); test!(git_dep_build_cmd { let p = git_repo("foo", |project| { @@ -1268,7 +1268,7 @@ test!(git_dep_build_cmd { assert_that( cargo::util::process(p.bin("foo")).unwrap(), execs().with_stdout("1\n")); -}) +}); test!(fetch_downloads { let bar = git_repo("bar", |project| { @@ -1298,7 +1298,7 @@ test!(fetch_downloads { assert_that(p.process(cargo_dir().join("cargo")).arg("fetch"), execs().with_status(0).with_stdout("")); -}) +}); test!(warnings_in_git_dep { let bar = git_repo("bar", |project| { @@ -1331,7 +1331,7 @@ test!(warnings_in_git_dep { COMPILING, bar.url(), COMPILING, p.url())) .with_stderr("")); -}) +}); test!(update_ambiguous { let foo1 = git_repo("foo1", |project| { @@ -1390,7 +1390,7 @@ following: foo:0.[..].0 foo:0.[..].0 ")); -}) +}); test!(update_one_dep_in_repo_with_many_deps { let foo = git_repo("foo", |project| { @@ -1430,7 +1430,7 @@ test!(update_one_dep_in_repo_with_many_deps { .with_stdout(format!("\ Updating git repository `{}` ", foo.url()))); -}) +}); test!(switch_deps_does_not_update_transitive { let transitive = git_repo("transitive", |project| { @@ -1507,7 +1507,7 @@ Updating git repository `{}` {compiling} dep [..] {compiling} project [..] ", dep2.url(), compiling = COMPILING))); -}) +}); test!(update_one_source_updates_all_packages_in_that_git_source { let dep = git_repo("dep", |project| { @@ -1562,7 +1562,7 @@ test!(update_one_source_updates_all_packages_in_that_git_source { .unwrap(); assert!(!lockfile.as_slice().contains(rev1.to_string().as_slice()), "{} in {}", rev1, lockfile); -}) +}); test!(switch_sources { let a1 = git_repo("a1", |project| { @@ -1631,4 +1631,4 @@ test!(switch_sources { {compiling} b v0.5.0 ([..]) {compiling} project v0.5.0 ([..]) ", updating = UPDATING, compiling = COMPILING).as_slice())); -}) +}); diff --git a/tests/test_cargo_compile_old_custom_build.rs b/tests/test_cargo_compile_old_custom_build.rs index f58fc27db..725a7ad0c 100644 --- a/tests/test_cargo_compile_old_custom_build.rs +++ b/tests/test_cargo_compile_old_custom_build.rs @@ -47,7 +47,7 @@ test!(old_custom_build { .with_stderr("warning: [..] deprecated.\n\ [..]\n\ [..]")); -}) +}); test!(old_custom_multiple_build { let mut build1 = project("builder1"); @@ -110,7 +110,7 @@ test!(old_custom_multiple_build { execs().with_status(0) .with_stdout(format!(" Compiling foo v0.5.0 ({})\n", p.url()))); -}) +}); test!(old_custom_build_failure { let mut build = project("builder"); @@ -159,7 +159,7 @@ task '
' panicked at 'nope', {filename}:2\n\ \n\ ", build.bin("foo").display(), filename = format!("src{}foo.rs", path::SEP), dir = p.url()))); -}) +}); test!(old_custom_second_build_failure { let mut build1 = project("builder1"); @@ -225,7 +225,7 @@ task '
' panicked at 'nope', {filename}:2\n\ \n\ ", build2.bin("bar").display(), filename = format!("src{}bar.rs", path::SEP), dir = p.url()))); -}) +}); test!(old_custom_build_env_vars { let bar = project("bar") @@ -312,7 +312,7 @@ test!(old_custom_build_env_vars { "#); assert_that(p.cargo_process("build").arg("--features").arg("foo"), execs().with_status(0)); -}) +}); test!(old_custom_build_in_dependency { let mut p = project("foo"); @@ -369,7 +369,7 @@ test!(old_custom_build_in_dependency { "#); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); // tests that custom build in dep can be built twice in a row - issue 227 test!(old_custom_build_in_dependency_twice { @@ -405,4 +405,4 @@ test!(old_custom_build_in_dependency_twice { execs().with_status(0)); assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0)); -}) +}); diff --git a/tests/test_cargo_compile_path_deps.rs b/tests/test_cargo_compile_path_deps.rs index 40175eb2f..480499257 100644 --- a/tests/test_cargo_compile_path_deps.rs +++ b/tests/test_cargo_compile_path_deps.rs @@ -99,7 +99,7 @@ test!(cargo_compile_with_nested_deps_shorthand { {} foo v0.5.0 ({})\n", COMPILING, p.url(), COMPILING, p.url()))); -}) +}); test!(cargo_compile_with_root_dev_deps { let p = project("foo") @@ -137,7 +137,7 @@ test!(cargo_compile_with_root_dev_deps { p2.build(); assert_that(p.cargo_process("build"), execs().with_status(101)) -}) +}); test!(cargo_compile_with_root_dev_deps_with_testing { let p = project("foo") @@ -184,7 +184,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, url = p.url(), running = RUNNING))); -}) +}); test!(cargo_compile_with_transitive_dev_deps { let p = project("foo") @@ -238,7 +238,7 @@ test!(cargo_compile_with_transitive_dev_deps { assert_that( cargo::util::process(p.bin("foo")).unwrap(), execs().with_stdout("zoidberg\n")); -}) +}); test!(no_rebuild_dependency { let mut p = project("foo"); @@ -286,7 +286,7 @@ test!(no_rebuild_dependency { {} foo v0.5.0 ({})\n", COMPILING, p.url(), COMPILING, p.url()))); -}) +}); test!(deep_dependencies_trigger_rebuild { let mut p = project("foo"); @@ -374,7 +374,7 @@ test!(deep_dependencies_trigger_rebuild { COMPILING, p.url(), COMPILING, p.url()))); -}) +}); test!(no_rebuild_two_deps { let mut p = project("foo"); @@ -436,7 +436,7 @@ test!(no_rebuild_two_deps { assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_stdout("")); assert_that(&p.bin("foo"), existing_file()); -}) +}); test!(nested_deps_recompile { let p = project("foo") @@ -487,7 +487,7 @@ test!(nested_deps_recompile { assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_stdout(format!("{} foo v0.5.0 ({})\n", COMPILING, p.url()))); -}) +}); test!(error_message_for_missing_manifest { let p = project("foo") @@ -514,7 +514,7 @@ test!(error_message_for_missing_manifest { .with_stderr(format!("Could not find `Cargo.toml` in `{}`\n", p.root().join_many(&["src", "bar"]).display()))); -}) +}); test!(override_relative { let bar = project("bar") @@ -547,7 +547,7 @@ test!(override_relative { bar.build(); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0)); -}) +}); test!(override_self { let bar = project("bar") @@ -583,7 +583,7 @@ test!(override_self { bar.build(); assert_that(p.cargo_process("build"), execs().with_status(0)); -}) +}); test!(override_path_dep { let bar = project("bar") @@ -627,7 +627,7 @@ test!(override_path_dep { assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0)); -}) +}); test!(path_dep_build_cmd { let p = project("foo") @@ -695,7 +695,7 @@ test!(path_dep_build_cmd { assert_that( cargo::util::process(p.bin("foo")).unwrap(), execs().with_stdout("1\n")); -}) +}); test!(dev_deps_no_rebuild_lib { let p = project("foo") @@ -743,4 +743,4 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", COMPILING, p.url(), COMPILING, p.url()))); -}) +}); diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index 2d6a7bd9f..9df838c7a 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -80,7 +80,7 @@ test!(plugin_to_the_max { execs().with_status(0)); assert_that(foo.process(cargo_dir().join("cargo")).arg("doc"), execs().with_status(0)); -}) +}); test!(plugin_with_dynamic_native_dependency { let build = project("builder") @@ -166,4 +166,4 @@ test!(plugin_with_dynamic_native_dependency { assert_that(foo.cargo_process("build").env("SRC", Some(lib.as_vec())), execs().with_status(0)); -}) +}); diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index 2c7e980d5..ec8d9d69d 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -71,7 +71,7 @@ test!(simple_cross { assert_that( process(p.target_bin(target, "foo")).unwrap(), execs().with_status(0)); -}) +}); test!(simple_deps { if disabled() { return } @@ -108,7 +108,7 @@ test!(simple_deps { assert_that( process(p.target_bin(target, "foo")).unwrap(), execs().with_status(0)); -}) +}); test!(plugin_deps { if disabled() { return } @@ -186,7 +186,7 @@ test!(plugin_deps { assert_that( process(foo.target_bin(target, "foo")).unwrap(), execs().with_status(0)); -}) +}); test!(plugin_to_the_max { if disabled() { return } @@ -271,7 +271,7 @@ test!(plugin_to_the_max { assert_that( process(foo.target_bin(target, "foo")).unwrap(), execs().with_status(0)); -}) +}); test!(linker_and_ar { if disabled() { return } @@ -311,7 +311,7 @@ test!(linker_and_ar { target = target, sep = path::SEP, ).as_slice())); -}) +}); test!(plugin_with_extra_dylib_dep { if disabled() { return } @@ -377,7 +377,7 @@ test!(plugin_with_extra_dylib_dep { let target = alternate(); assert_that(foo.cargo_process("build").arg("--target").arg(target), execs().with_status(0)); -}) +}); test!(cross_tests { if disabled() { return } @@ -433,7 +433,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, running = RUNNING, foo = p.url(), triple = target, doctest = DOCTEST))); -}) +}); test!(simple_cargo_run { if disabled() { return } @@ -455,7 +455,7 @@ test!(simple_cargo_run { let target = alternate(); assert_that(p.cargo_process("run").arg("--target").arg(target), execs().with_status(0)); -}) +}); test!(cross_but_no_dylibs { let p = project("foo") @@ -474,7 +474,7 @@ test!(cross_but_no_dylibs { execs().with_status(101) .with_stderr("dylib outputs are not supported for \ arm-apple-ios")); -}) +}); test!(cross_with_a_build_script { if disabled() { return } @@ -515,7 +515,7 @@ test!(cross_with_a_build_script { {running} `rustc {dir}{sep}src{sep}main.rs [..] --target {target} [..]` ", compiling = COMPILING, running = RUNNING, target = target, dir = p.root().display(), sep = path::SEP).as_slice())); -}) +}); test!(build_script_needed_for_host_and_target { if disabled() { return } @@ -597,7 +597,7 @@ test!(build_script_needed_for_host_and_target { -L /path/to/{target}` ", compiling = COMPILING, running = RUNNING, target = target, host = host, dir = p.root().display(), sep = path::SEP).as_slice())); -}) +}); test!(build_deps_for_the_right_arch { if disabled() { return } @@ -638,7 +638,7 @@ test!(build_deps_for_the_right_arch { let target = alternate(); assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"), execs().with_status(0)); -}) +}); test!(build_script_only_host { if disabled() { return } @@ -679,4 +679,4 @@ test!(build_script_only_host { let target = alternate(); assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"), execs().with_status(0)); -}) +}); diff --git a/tests/test_cargo_doc.rs b/tests/test_cargo_doc.rs index 60525f586..2e963802b 100644 --- a/tests/test_cargo_doc.rs +++ b/tests/test_cargo_doc.rs @@ -26,7 +26,7 @@ test!(simple { dir = path2url(p.root())).as_slice())); assert_that(&p.root().join("target/doc"), existing_dir()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); -}) +}); test!(doc_no_libs { let p = project("foo") @@ -46,7 +46,7 @@ test!(doc_no_libs { assert_that(p.cargo_process("doc"), execs().with_status(0)); -}) +}); test!(doc_twice { let p = project("foo") @@ -69,7 +69,7 @@ test!(doc_twice { assert_that(p.process(cargo_dir().join("cargo")).arg("doc"), execs().with_status(0).with_stdout("")) -}) +}); test!(doc_deps { let p = project("foo") @@ -115,7 +115,7 @@ test!(doc_deps { assert_that(&p.root().join("target/doc"), existing_dir()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); assert_that(&p.root().join("target/doc/bar/index.html"), existing_file()); -}) +}); test!(doc_no_deps { let p = project("foo") @@ -153,7 +153,7 @@ test!(doc_no_deps { assert_that(&p.root().join("target/doc"), existing_dir()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); assert_that(&p.root().join("target/doc/bar/index.html"), is_not(existing_file())); -}) +}); test!(doc_only_bin { let p = project("foo") @@ -186,7 +186,7 @@ test!(doc_only_bin { assert_that(&p.root().join("target/doc"), existing_dir()); assert_that(&p.root().join("target/doc/bar/index.html"), existing_file()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); -}) +}); test!(doc_lib_bin_same_name { let p = project("foo") @@ -205,7 +205,7 @@ test!(doc_lib_bin_same_name { Cannot document a package where a library and a binary have the same name. \ Consider renaming one or marking the target as `doc = false` ")); -}) +}); test!(doc_dash_p { let p = project("foo") @@ -243,4 +243,4 @@ test!(doc_dash_p { {compiling} b v0.0.1 (file://[..]) {compiling} a v0.0.1 (file://[..]) ", compiling = COMPILING).as_slice())); -}) +}); diff --git a/tests/test_cargo_features.rs b/tests/test_cargo_features.rs index b5353f750..65b3bc9fd 100644 --- a/tests/test_cargo_features.rs +++ b/tests/test_cargo_features.rs @@ -27,7 +27,7 @@ Cargo.toml is not a valid manifest Feature `bar` includes `baz` which is neither a dependency nor another feature ").as_slice())); -}) +}); test!(invalid2 { let p = project("foo") @@ -51,7 +51,7 @@ Cargo.toml is not a valid manifest Features and dependencies cannot have the same name: `bar` ").as_slice())); -}) +}); test!(invalid3 { let p = project("foo") @@ -76,7 +76,7 @@ Cargo.toml is not a valid manifest Feature `bar` depends on `baz` which is not an optional dependency. Consider adding `optional = true` to the dependency ").as_slice())); -}) +}); test!(invalid4 { let p = project("foo") @@ -115,7 +115,7 @@ Package `bar v0.0.1 ([..])` does not have these features: `bar` execs().with_status(101).with_stderr(format!("\ Package `foo v0.0.1 ([..])` does not have these features: `test` ").as_slice())); -}) +}); test!(invalid5 { let p = project("foo") @@ -137,7 +137,7 @@ Cargo.toml is not a valid manifest Dev-dependencies are not allowed to be optional: `bar` ").as_slice())); -}) +}); test!(invalid6 { let p = project("foo") @@ -158,7 +158,7 @@ Cargo.toml is not a valid manifest Feature `foo` requires `bar` which is not an optional dependency ").as_slice())); -}) +}); test!(invalid7 { let p = project("foo") @@ -180,7 +180,7 @@ Cargo.toml is not a valid manifest Feature `foo` requires `bar` which is not an optional dependency ").as_slice())); -}) +}); test!(invalid8 { let p = project("foo") @@ -207,7 +207,7 @@ test!(invalid8 { execs().with_status(101).with_stderr(format!("\ features in dependencies cannot enable features in other dependencies: `foo/bar` ").as_slice())); -}) +}); test!(no_feature_doesnt_build { let p = project("foo") @@ -251,7 +251,7 @@ test!(no_feature_doesnt_build { ", compiling = COMPILING, dir = p.url()).as_slice())); assert_that(p.process(p.bin("foo")), execs().with_status(0).with_stdout("bar\n")); -}) +}); test!(default_feature_pulled_in { let p = project("foo") @@ -298,7 +298,7 @@ test!(default_feature_pulled_in { {compiling} foo v0.0.1 ({dir}) ", compiling = COMPILING, dir = p.url()).as_slice())); assert_that(p.process(p.bin("foo")), execs().with_status(0).with_stdout("")); -}) +}); test!(cyclic_feature { let p = project("foo") @@ -317,7 +317,7 @@ test!(cyclic_feature { execs().with_status(101).with_stderr("\ Cyclic feature dependency: feature `default` depends on itself ")); -}) +}); test!(cyclic_feature2 { let p = project("foo") @@ -337,7 +337,7 @@ test!(cyclic_feature2 { execs().with_status(101).with_stderr("\ Cyclic feature dependency: feature `[..]` depends on itself ")); -}) +}); test!(groups_on_groups_on_groups { let p = project("foo") @@ -391,7 +391,7 @@ test!(groups_on_groups_on_groups { {compiling} ba[..] v0.0.1 ({dir}) {compiling} foo v0.0.1 ({dir}) ", compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(many_cli_features { let p = project("foo") @@ -435,7 +435,7 @@ test!(many_cli_features { {compiling} ba[..] v0.0.1 ({dir}) {compiling} foo v0.0.1 ({dir}) ", compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(union_features { let p = project("foo") @@ -496,7 +496,7 @@ test!(union_features { {compiling} d1 v0.0.1 ({dir}) {compiling} foo v0.0.1 ({dir}) ", compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(many_features_no_rebuilds { let p = project("foo") @@ -536,7 +536,7 @@ test!(many_features_no_rebuilds { {fresh} a v0.1.0 ([..]) {fresh} b v0.1.0 ([..]) ", fresh = FRESH).as_slice())); -}) +}); // Tests that all cmd lines work with `--features ""` test!(empty_features { @@ -551,7 +551,7 @@ test!(empty_features { assert_that(p.cargo_process("build").arg("--features").arg(""), execs().with_status(0)); -}) +}); // Tests that all cmd lines work with `--features ""` test!(transitive_features { @@ -588,7 +588,7 @@ test!(transitive_features { assert_that(p.cargo_process("build").arg("--features").arg("foo"), execs().with_status(0)); -}) +}); test!(everything_in_the_lockfile { let p = project("foo") @@ -646,4 +646,4 @@ test!(everything_in_the_lockfile { assert!(lockfile.contains(r#"name = "d1""#), "d1 not found\n{}", lockfile); assert!(lockfile.contains(r#"name = "d2""#), "d2 not found\n{}", lockfile); assert!(lockfile.contains(r#"name = "d3""#), "d3 not found\n{}", lockfile); -}) +}); diff --git a/tests/test_cargo_fetch.rs b/tests/test_cargo_fetch.rs index 7ebd1cde5..b0bf231df 100644 --- a/tests/test_cargo_fetch.rs +++ b/tests/test_cargo_fetch.rs @@ -18,4 +18,4 @@ test!(no_deps { assert_that(p.cargo_process("fetch"), execs().with_status(0).with_stdout("")); -}) +}); diff --git a/tests/test_cargo_freshness.rs b/tests/test_cargo_freshness.rs index 4f78183a9..8f2d05510 100644 --- a/tests/test_cargo_freshness.rs +++ b/tests/test_cargo_freshness.rs @@ -38,7 +38,7 @@ test!(modifying_and_moving { fs::rename(&p.root().join("src/a.rs"), &p.root().join("src/b.rs")).assert(); assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(101)); -}) +}); test!(modify_only_some_files { let p = project("foo") @@ -82,4 +82,4 @@ test!(modify_only_some_files { {compiling} foo v0.0.1 ({dir}) ", compiling = COMPILING, dir = path2url(p.root())))); assert_that(&p.bin("foo"), existing_file()); -}) +}); diff --git a/tests/test_cargo_generate_lockfile.rs b/tests/test_cargo_generate_lockfile.rs index 9dd5c19bd..b0e58e44e 100644 --- a/tests/test_cargo_generate_lockfile.rs +++ b/tests/test_cargo_generate_lockfile.rs @@ -28,7 +28,7 @@ test!(ignores_carriage_return { File::create(&lockfile).write_str(lock.as_slice()).assert(); assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0)); -}) +}); test!(adding_and_removing_packages { let p = project("foo") @@ -93,7 +93,7 @@ test!(adding_and_removing_packages { execs().with_status(0)); let lock4 = File::open(&lockfile).read_to_string().assert(); assert_eq!(lock1, lock4); -}) +}); test!(preserve_metadata { let p = project("foo") @@ -137,4 +137,4 @@ foo = "bar" execs().with_status(0)); let lock = File::open(&lockfile).read_to_string().assert(); assert!(lock.as_slice().contains(metadata.trim()), "{}", lock); -}) +}); diff --git a/tests/test_cargo_new.rs b/tests/test_cargo_new.rs index d480caab0..044076657 100644 --- a/tests/test_cargo_new.rs +++ b/tests/test_cargo_new.rs @@ -34,7 +34,7 @@ test!(simple_lib { assert_that(cargo_process("build").cwd(paths::root().join("foo")), execs().with_status(0)); -}) +}); test!(simple_bin { os::setenv("USER", "foo"); @@ -50,7 +50,7 @@ test!(simple_bin { assert_that(&paths::root().join(format!("foo/target/foo{}", os::consts::EXE_SUFFIX)), existing_file()); -}) +}); test!(simple_git { let td = TempDir::new("cargo").unwrap(); @@ -66,7 +66,7 @@ test!(simple_git { assert_that(cargo_process("build").cwd(td.path().clone().join("foo")), execs().with_status(0)); -}) +}); test!(simple_travis { os::setenv("USER", "foo"); @@ -80,7 +80,7 @@ test!(simple_travis { assert_that(cargo_process("build").cwd(paths::root().join("foo")), execs().with_status(0)); -}) +}); test!(no_argument { assert_that(cargo_process("new"), @@ -90,7 +90,7 @@ Usage: cargo new [options] cargo new -h | --help ")); -}) +}); test!(existing { let dst = paths::root().join("foo"); @@ -99,13 +99,13 @@ test!(existing { execs().with_status(101) .with_stderr(format!("Destination `{}` already exists\n", dst.display()))); -}) +}); test!(invalid_characters { assert_that(cargo_process("new").arg("foo.rs"), execs().with_status(101) .with_stderr("Invalid character `.` in crate name: `foo.rs`")); -}) +}); test!(finds_author_user { // Use a temp dir to make sure we don't pick up .cargo/config somewhere in @@ -118,7 +118,7 @@ test!(finds_author_user { let toml = td.path().join("foo/Cargo.toml"); let toml = File::open(&toml).read_to_string().assert(); assert!(toml.as_slice().contains(r#"authors = ["foo"]"#)); -}) +}); test!(finds_author_username { // Use a temp dir to make sure we don't pick up .cargo/config somewhere in @@ -133,7 +133,7 @@ test!(finds_author_username { let toml = td.path().join("foo/Cargo.toml"); let toml = File::open(&toml).read_to_string().assert(); assert!(toml.as_slice().contains(r#"authors = ["foo"]"#)); -}) +}); test!(finds_author_git { my_process("git").args(&["config", "--global", "user.name", "bar"]) @@ -146,7 +146,7 @@ test!(finds_author_git { let toml = paths::root().join("foo/Cargo.toml"); let toml = File::open(&toml).read_to_string().assert(); assert!(toml.as_slice().contains(r#"authors = ["bar "]"#)); -}) +}); test!(author_prefers_cargo { my_process("git").args(&["config", "--global", "user.name", "bar"]) @@ -169,7 +169,7 @@ test!(author_prefers_cargo { let toml = File::open(&toml).read_to_string().assert(); assert!(toml.as_slice().contains(r#"authors = ["new-foo "]"#)); assert!(!root.join("foo/.gitignore").exists()); -}) +}); test!(git_prefers_command_line { let root = paths::root(); @@ -186,7 +186,7 @@ test!(git_prefers_command_line { .env("USER", Some("foo")), execs().with_status(0)); assert!(td.path().join("foo/.gitignore").exists()); -}) +}); test!(subpackage_no_git { os::setenv("USER", "foo"); @@ -201,4 +201,4 @@ test!(subpackage_no_git { is_not(existing_file())); assert_that(&paths::root().join("foo/components/subcomponent/.gitignore"), is_not(existing_file())); -}) +}); diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index 87c1b3efa..1de06e6d2 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -57,7 +57,7 @@ src[..]main.rs fname == b"foo-0.0.1/src/main.rs", "unexpected filename: {}", f.filename()) } -}) +}); test!(metadata_warning { let p = project("all") @@ -133,7 +133,7 @@ http://doc.crates.io/manifest.html#package-metadata for more info.")); verifying = VERIFYING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(package_verbose { let root = paths::root().join("all"); @@ -168,7 +168,7 @@ test!(package_verbose { ", packaging = PACKAGING, archiving = ARCHIVING).as_slice())); -}) +}); test!(package_verification { let p = project("all") @@ -193,4 +193,4 @@ test!(package_verification { verifying = VERIFYING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); diff --git a/tests/test_cargo_profiles.rs b/tests/test_cargo_profiles.rs index 8813a4994..ccd29cb12 100644 --- a/tests/test_cargo_profiles.rs +++ b/tests/test_cargo_profiles.rs @@ -42,7 +42,7 @@ running = RUNNING, compiling = COMPILING, sep = path::SEP, dir = p.root().display(), url = p.url(), ))); -}) +}); test!(top_level_overrides_deps { let mut p = project("foo"); @@ -112,4 +112,4 @@ test!(top_level_overrides_deps { sep = path::SEP, prefix = os::consts::DLL_PREFIX, suffix = os::consts::DLL_SUFFIX).as_slice())); -}) +}); diff --git a/tests/test_cargo_publish.rs b/tests/test_cargo_publish.rs index cfeae4e22..ac8f5c74e 100644 --- a/tests/test_cargo_publish.rs +++ b/tests/test_cargo_publish.rs @@ -75,7 +75,7 @@ test!(simple { fname == b"foo-0.0.1/src/main.rs", "unexpected filename: {}", file.filename()) } -}) +}); test!(git_deps { let p = project("foo") @@ -97,7 +97,7 @@ test!(git_deps { all dependencies must come from the same source. dependency `foo` comes from git://path/to/nowhere instead ")); -}) +}); test!(path_dependency_no_version { let p = project("foo") @@ -126,4 +126,4 @@ test!(path_dependency_no_version { all path dependencies must have a version specified when publishing. dependency `bar` does not specify a version ")); -}) +}); diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 2b4792359..3c7abcb51 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -51,7 +51,7 @@ test!(simple { updating = UPDATING, dir = p.url(), reg = r::registry()).as_slice())); -}) +}); test!(deps { let p = project("foo") @@ -83,7 +83,7 @@ test!(deps { compiling = COMPILING, dir = p.url(), reg = r::registry()).as_slice())); -}) +}); test!(nonexistent { let p = project("foo") @@ -104,7 +104,7 @@ no package named `nonexistent` found (required by `foo`) location searched: registry file://[..] version required: >= 0.0.0 ")); -}) +}); test!(bad_cksum { let p = project("foo") @@ -132,7 +132,7 @@ Caused by: Caused by: Failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])` ")); -}) +}); test!(update_registry { let p = project("foo") @@ -168,7 +168,7 @@ version required: >= 0.0.0 compiling = COMPILING, dir = p.url(), reg = r::registry()).as_slice())); -}) +}); test!(package_with_path_deps { let p = project("foo") @@ -223,7 +223,7 @@ version required: ^0.0.1 compiling = COMPILING, dir = p.url(), ))); -}) +}); test!(lockfile_locks { let p = project("foo") @@ -255,7 +255,7 @@ test!(lockfile_locks { assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0).with_stdout("")); -}) +}); test!(lockfile_locks_transitively { let p = project("foo") @@ -291,7 +291,7 @@ test!(lockfile_locks_transitively { assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0).with_stdout("")); -}) +}); test!(yanks_are_not_used { let p = project("foo") @@ -322,7 +322,7 @@ test!(yanks_are_not_used { {compiling} foo v0.0.1 ({dir}) ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(relying_on_a_yank_is_bad { let p = project("foo") @@ -348,7 +348,7 @@ no package named `baz` found (required by `bar`) location searched: registry file://[..] version required: = 0.0.2 ")); -}) +}); test!(yanks_in_lockfiles_are_ok { let p = project("foo") @@ -382,7 +382,7 @@ no package named `bar` found (required by `foo`) location searched: registry file://[..] version required: * ")); -}) +}); test!(update_with_lockfile_if_packages_missing { let p = project("foo") @@ -409,7 +409,7 @@ test!(update_with_lockfile_if_packages_missing { {updating} registry `[..]` {downloading} bar v0.0.1 (registry file://[..]) ", updating = UPDATING, downloading = DOWNLOADING).as_slice())); -}) +}); test!(update_lockfile { let p = project("foo") @@ -444,7 +444,7 @@ test!(update_lockfile { {compiling} foo v0.0.1 ({dir}) ", downloading = DOWNLOADING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(dev_dependency_not_used { let p = project("foo") @@ -471,7 +471,7 @@ test!(dev_dependency_not_used { {compiling} foo v0.0.1 ({dir}) ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(login_with_no_cargo_dir { let home = paths::home().join("new-home"); @@ -481,7 +481,7 @@ test!(login_with_no_cargo_dir { .cwd(paths::root()) .env("HOME", Some(home)), execs().with_status(0)); -}) +}); test!(bad_license_file { let p = project("all") @@ -501,7 +501,7 @@ test!(bad_license_file { execs().with_status(101) .with_stderr("\ the license file `foo` does not exist")); -}) +}); test!(updating_a_dep { let p = project("foo") @@ -560,7 +560,7 @@ test!(updating_a_dep { {compiling} foo v0.0.1 ({dir}) ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(git_and_registry_dep { let b = git::repo(&paths::root().join("b")) @@ -609,7 +609,7 @@ test!(git_and_registry_dep { println!("second"); assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0).with_stdout("")); -}) +}); test!(update_publish_then_update { let p = project("foo") @@ -649,4 +649,4 @@ test!(update_publish_then_update { ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); diff --git a/tests/test_cargo_run.rs b/tests/test_cargo_run.rs index a5c8de00b..26ab98e20 100644 --- a/tests/test_cargo_run.rs +++ b/tests/test_cargo_run.rs @@ -30,7 +30,7 @@ hello dir = path2url(p.root()), sep = path::SEP).as_slice())); assert_that(&p.bin("foo"), existing_file()); -}) +}); test!(simple_with_args { let p = project("foo") @@ -49,7 +49,7 @@ test!(simple_with_args { assert_that(p.cargo_process("run").arg("hello").arg("world"), execs().with_status(0)); -}) +}); test!(exit_code { let p = project("foo") @@ -65,7 +65,7 @@ test!(exit_code { assert_that(p.cargo_process("run"), execs().with_status(2)); -}) +}); test!(no_main_file { let p = project("foo") @@ -81,7 +81,7 @@ test!(no_main_file { execs().with_status(101) .with_stderr("a bin target must be available \ for `cargo run`\n")); -}) +}); test!(too_many_bins { let p = project("foo") @@ -100,7 +100,7 @@ test!(too_many_bins { .with_stderr("`cargo run` requires that a project only \ have one executable. Use the `--bin` option \ to specify which one to run\n")); -}) +}); test!(specify_name { let p = project("foo") @@ -138,7 +138,7 @@ hello b.rs ", running = RUNNING, sep = path::SEP).as_slice())); -}) +}); test!(run_example { let p = project("foo") @@ -166,7 +166,7 @@ example running = RUNNING, dir = path2url(p.root()), sep = path::SEP).as_slice())); -}) +}); test!(either_name_or_example { let p = project("foo") @@ -187,7 +187,7 @@ test!(either_name_or_example { execs().with_status(1) .with_stderr("specify either `--bin` or `--example`, \ not both")); -}) +}); test!(one_bin_multiple_examples { let p = project("foo") @@ -218,7 +218,7 @@ hello main.rs running = RUNNING, dir = path2url(p.root()), sep = path::SEP).as_slice())); -}) +}); test!(run_dylib_dep { let p = project("foo") @@ -249,7 +249,7 @@ test!(run_dylib_dep { assert_that(p.cargo_process("run").arg("hello").arg("world"), execs().with_status(0)); -}) +}); test!(release_works { let p = project("foo") @@ -273,7 +273,7 @@ test!(release_works { dir = path2url(p.root()), sep = path::SEP).as_slice())); assert_that(&p.release_bin("foo"), existing_file()); -}) +}); test!(run_bin_different_name { let p = project("foo") @@ -291,4 +291,4 @@ test!(run_bin_different_name { "#); assert_that(p.cargo_process("run"), execs().with_status(0)); -}) +}); diff --git a/tests/test_cargo_search.rs b/tests/test_cargo_search.rs index c2cf6a705..664d06208 100644 --- a/tests/test_cargo_search.rs +++ b/tests/test_cargo_search.rs @@ -82,4 +82,4 @@ test!(simple { execs().with_status(0).with_stdout(format!("\ {updating} registry `[..]` hoare (0.1.1) Design by contract style assertions for Rust", updating = UPDATING))); -}) +}); diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index f065c17f0..ff0d23c54 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -46,7 +46,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", COMPILING, p.url(), RUNNING))); -}) +}); test!(cargo_test_verbose { let p = project("foo") @@ -69,7 +69,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, url = p.url(), running = RUNNING))); -}) +}); test!(many_similar_names { let p = project("foo") @@ -98,7 +98,7 @@ test!(many_similar_names { assert!(output.contains("test bin_test"), "bin_test missing\n{}", output); assert!(output.contains("test lib_test"), "lib_test missing\n{}", output); assert!(output.contains("test test_test"), "test_test missing\n{}", output); -}) +}); test!(cargo_test_failing_test { let p = project("foo") @@ -153,7 +153,7 @@ test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured task '
' panicked at 'Some tests failed', [..] ")) .with_status(101)); -}) +}); test!(test_with_lib_dep { let p = project("foo") @@ -214,7 +214,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", COMPILING, p.url(), running = RUNNING, doctest = DOCTEST))) -}) +}); test!(test_with_deep_lib_dep { let p = project("bar") @@ -277,7 +277,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured compiling = COMPILING, running = RUNNING, doctest = DOCTEST, dir = p.url()).as_slice())); -}) +}); test!(external_test_explicit { let p = project("foo") @@ -329,7 +329,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", COMPILING, p.url(), running = RUNNING, doctest = DOCTEST))) -}) +}); test!(external_test_implicit { let p = project("foo") @@ -377,7 +377,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", COMPILING, p.url(), running = RUNNING, doctest = DOCTEST))) -}) +}); test!(dont_run_examples { let p = project("foo") @@ -394,7 +394,7 @@ test!(dont_run_examples { "#); assert_that(p.cargo_process("test"), execs().with_status(0)); -}) +}); test!(pass_through_command_line { let p = project("foo") @@ -452,7 +452,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured compiling = COMPILING, running = RUNNING, doctest = DOCTEST, dir = p.url()).as_slice())); -}) +}); // Regression test for running cargo-test twice with // tests in an rlib @@ -472,7 +472,7 @@ test!(cargo_test_twice { assert_that(p.process(cargo_dir().join("cargo")).arg("test"), execs().with_status(0)); } -}) +}); test!(lib_bin_same_name { let p = project("foo") @@ -522,7 +522,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", COMPILING, p.url(), running = RUNNING, doctest = DOCTEST))) -}) +}); test!(lib_with_standard_name { let p = project("foo") @@ -576,7 +576,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, running = RUNNING, doctest = DOCTEST, dir = p.url()).as_slice())); -}) +}); test!(lib_with_standard_name2 { let p = project("foo") @@ -617,7 +617,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(bin_there_for_integration { let p = project("foo") @@ -644,7 +644,7 @@ test!(bin_there_for_integration { let output = str::from_utf8(output.output.as_slice()).assert(); assert!(output.contains("main_test ... ok"), "no main_test\n{}", output); assert!(output.contains("test_test ... ok"), "no test_test\n{}", output); -}) +}); test!(test_dylib { let p = project("foo") @@ -746,7 +746,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured running = RUNNING, doctest = DOCTEST))); -}) +}); test!(test_twice_with_build_cmd { let p = project("foo") @@ -803,7 +803,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", running = RUNNING, doctest = DOCTEST))); -}) +}); test!(test_then_build { let p = project("foo") @@ -843,7 +843,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured assert_that(p.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0) .with_stdout("")); -}) +}); test!(test_no_run { let p = project("foo") @@ -865,7 +865,7 @@ test!(test_no_run { ", compiling = COMPILING, dir = p.url()).as_slice())); -}) +}); test!(test_run_specific_bin_target { let prj = project("foo") @@ -902,7 +902,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured assert_that(prj.cargo_process("test").arg("--test").arg("bin2"), execs().with_status(0).with_stdout(expected_stdout.as_slice())); -}) +}); test!(test_run_specific_test_target { let prj = project("foo") @@ -940,7 +940,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured assert_that(prj.cargo_process("test").arg("--test").arg("b"), execs().with_status(0).with_stdout(expected_stdout.as_slice())); -}) +}); test!(test_no_harness { let p = project("foo") @@ -970,7 +970,7 @@ test!(test_no_harness { ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(selective_testing { let p = project("foo") @@ -1057,7 +1057,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured\n ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice())); -}) +}); test!(almost_cyclic_but_not_quite { let p = project("a") @@ -1099,7 +1099,7 @@ test!(almost_cyclic_but_not_quite { assert_that(p.cargo_process("build"), execs().with_status(0)); assert_that(p.process(cargo_dir().join("cargo")).arg("test"), execs().with_status(0)); -}) +}); test!(build_then_selective_test { let p = project("a") @@ -1127,7 +1127,7 @@ test!(build_then_selective_test { assert_that(p.process(cargo_dir().join("cargo")).arg("test") .arg("-p").arg("b"), execs().with_status(0)); -}) +}); test!(example_dev_dep { let p = project("foo") @@ -1155,25 +1155,25 @@ test!(example_dev_dep { .file("bar/src/lib.rs", r#" #![feature(macro_rules)] // make sure this file takes awhile to compile - macro_rules! f0( () => (1u) ) - macro_rules! f1( () => ({(f0!()) + (f0!())}) ) - macro_rules! f2( () => ({(f1!()) + (f1!())}) ) - macro_rules! f3( () => ({(f2!()) + (f2!())}) ) - macro_rules! f4( () => ({(f3!()) + (f3!())}) ) - macro_rules! f5( () => ({(f4!()) + (f4!())}) ) - macro_rules! f6( () => ({(f5!()) + (f5!())}) ) - macro_rules! f7( () => ({(f6!()) + (f6!())}) ) - macro_rules! f8( () => ({(f7!()) + (f7!())}) ) - macro_rules! f9( () => ({(f8!()) + (f8!())}) ) - macro_rules! f10( () => ({(f9!()) + (f9!())}) ) - macro_rules! f11( () => ({(f10!()) + (f10!())}) ) + macro_rules! f0( () => (1u) ); + macro_rules! f1( () => ({(f0!()) + (f0!())}) ); + macro_rules! f2( () => ({(f1!()) + (f1!())}) ); + macro_rules! f3( () => ({(f2!()) + (f2!())}) ); + macro_rules! f4( () => ({(f3!()) + (f3!())}) ); + macro_rules! f5( () => ({(f4!()) + (f4!())}) ); + macro_rules! f6( () => ({(f5!()) + (f5!())}) ); + macro_rules! f7( () => ({(f6!()) + (f6!())}) ); + macro_rules! f8( () => ({(f7!()) + (f7!())}) ); + macro_rules! f9( () => ({(f8!()) + (f8!())}) ); + macro_rules! f10( () => ({(f9!()) + (f9!())}) ); + macro_rules! f11( () => ({(f10!()) + (f10!())}) ); pub fn bar() { f11!(); } "#); assert_that(p.cargo_process("test"), execs().with_status(0)); -}) +}); test!(selective_testing_with_docs { let p = project("foo") @@ -1224,7 +1224,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", compiling = COMPILING, running = RUNNING, dir = p.url(), doctest = DOCTEST).as_slice())); -}) +}); test!(example_bin_same_name { let p = project("foo") @@ -1253,7 +1253,7 @@ test!(example_bin_same_name { execs().with_status(0).with_stdout("bin\n")); assert_that(p.process(p.bin("examples/foo")), execs().with_status(0).with_stdout("example\n")); -}) +}); test!(test_with_example_twice { let p = project("foo") @@ -1274,4 +1274,4 @@ test!(test_with_example_twice { assert_that(p.process(cargo_dir().join("cargo")).arg("test").arg("-v"), execs().with_status(0)); assert_that(&p.bin("examples/foo"), existing_file()); -}) +}); diff --git a/tests/test_cargo_version.rs b/tests/test_cargo_version.rs index cca8e721b..7d8dc6336 100644 --- a/tests/test_cargo_version.rs +++ b/tests/test_cargo_version.rs @@ -15,4 +15,4 @@ test!(simple { execs().with_status(0).with_stdout(format!("{}\n", cargo::version()).as_slice())); -}) +}); diff --git a/tests/test_shell.rs b/tests/test_shell.rs index a500d0827..76e821f0e 100644 --- a/tests/test_shell.rs +++ b/tests/test_shell.rs @@ -24,7 +24,7 @@ test!(non_tty { let buf = rx.read_to_end().unwrap(); assert_that(buf.as_slice(), shell_writes("Hey Alex\n")); -}) +}); test!(color_explicitly_disabled { let config = ShellConfig { color: false, verbose: true, tty: true }; @@ -35,7 +35,7 @@ test!(color_explicitly_disabled { }); let buf = rx.read_to_end().unwrap(); assert_that(buf.as_slice(), shell_writes("Hey Alex\n")); -}) +}); test!(colored_shell { let term = TerminfoTerminal::new(MemWriter::new()); @@ -51,7 +51,7 @@ test!(colored_shell { assert_that(buf.as_slice(), shell_writes(colored_output("Hey Alex\n", color::RED).assert())); -}) +}); fn colored_output(string: S, color: color::Color) -> IoResult { let mut term = TerminfoTerminal::new(MemWriter::new()).unwrap(); diff --git a/tests/tests.rs b/tests/tests.rs index a30e08066..ca5326700 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -14,7 +14,7 @@ extern crate url; extern crate log; mod support; -macro_rules! test( +macro_rules! test { ($name:ident $expr:expr) => ( #[test] fn $name() { @@ -23,7 +23,7 @@ macro_rules! test( $expr; } ) -) +} mod test_cargo; mod test_cargo_bench; -- 2.30.2